ci: add conventional commit checks #1
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: Conventional Commits | |
on: # yamllint disable-line rule:truthy | |
pull_request: | |
types: [opened, reopened, edited, synchronize] | |
workflow_dispatch: # yamllint disable-line rule:empty-values | |
jobs: | |
lint-pull-request: | |
name: Lint Pull Request | |
if: github.event_name == 'pull_request' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: PR Linting | |
run: | | |
.conventional-commits/scripts/lint-pull-request.sh '${{ github.event.pull_request.title }}' '${{ github.event.pull_request.body }}' '${{ github.workspace }}/.conventional-commits/commitlint.pr.config.js' | |
lint-commit-history: | |
name: Lint Commit History | |
runs-on: ubuntu-latest | |
env: | |
target_branch: ${{ github.base_ref || 'main' }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # Required for commit linting | |
- name: Commit Linting | |
run: | | |
TARGET_BRANCH_COMMIT=$(git show-ref -s ${{ env.target_branch }}) | |
SOURCE_BRANCH_COMMIT=${{github.event.pull_request.head.sha}} | |
.conventional-commits/scripts/lint-commit-history.sh "$TARGET_BRANCH_COMMIT" "$SOURCE_BRANCH_COMMIT" "${{ github.workspace }}/.conventional-commits/commitlint.commit.config.js" |