Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: Add Conventional commit linter to GitHub Workflows #50

Merged
merged 2 commits into from
Jan 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .commitlintrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
extends:
- '@commitlint/config-conventional'
49 changes: 39 additions & 10 deletions .github/workflows/verify.yaml
Original file line number Diff line number Diff line change
@@ -1,37 +1,66 @@
# yamllint disable rule:empty-lines

name: Verify
run-name: ${{ github.actor }} is testing out GitHub Actions 🚀
on: [push]
on:
push:
branches:
- main
paths-ignore:
- '**/*.md'
- .gitignore
- .github/**
- .idea/**
- .vscode/**
pull_request:
branches:
- main

jobs:

unit-and-integration-test:
runs-on: ubuntu-latest
steps:
- run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event."
- run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!"
- run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
- name: Check out repository code
uses: actions/checkout@v4
- uses: actions/checkout@v4
with:
clean: false
- run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner."
- run: echo "🖥️ The workflow is now ready to test your code on the runner."
- name: List files in the repository
run: ls -AlF ${{ github.workspace }}
- run: ls -AlF ${{ github.workspace }}
- run: ${{ github.workspace }}/dev all-test
- run: echo "🍏 This job's status is ${{ job.status }}."

lint:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: List files in the repository
run: ls ${{ github.workspace }}
- uses: actions/checkout@v4
with:
fetch-depth: 0
- run: ls ${{ github.workspace }}

- name: MegaLinter
id: ml
# You can override MegaLinter flavor used to have faster performances
# More info at https://megalinter.io/flavors/
uses: oxsecurity/megalinter@v7
uses: oxsecurity/megalinter/flavors/python@v7.7.0
env:
# All available variables are described in documentation
# https://megalinter.io/configuration/
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VALIDATE_ALL_CODEBASE: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} # Validates all source when push on main, else just the git diff with main. Override with true if you always want to lint all sources

- if: github.event_name == 'pull_request'
name: Setup Node for Commit Linter
uses: actions/setup-node@v4
with:
node-version: 21.x

- if: github.event_name == 'pull_request'
run: npm install

- if: github.event_name == 'pull_request'
name: Validate all commits from PR
run: npx commitlint --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }} --verbose
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,6 @@ bin/
### MegaLinter reports and logs
/logback.log
/megalinter-reports/

### Node
node_modules/
Loading