Skip to content

Commit

Permalink
chore: commitlint only the Pull Request HEAD (#4983)
Browse files Browse the repository at this point in the history
we only want the first commit to be linted
  • Loading branch information
soyuka authored Sep 20, 2022
1 parent b0730bb commit 8691fdf
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .commitlintrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"defaultIgnores": true,
"parserPreset": "conventional-changelog-conventionalcommits",
"extends": "@commitlint/config-conventional",
"rules": {
"scope-enum": [
2,
Expand Down
15 changes: 13 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,24 @@ env:

jobs:
commitlint:
if: github.event_name == 'pull_request'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
configFile: .commitlintrc
- uses: wagoid/commitlint-github-action@v5
- name: Run commitlint
run: |
commit=$(gh api \
-H "Accept: application/vnd.github+json" \
/repos/${{ github.repository }}/pulls/${{github.event.number}}/commits \
| jq -r '.[0].commit.message')
# we can't use npx see https://github.com/conventional-changelog/commitlint/issues/613
echo '{}' > package.json
npm install --no-fund --no-audit @commitlint/config-conventional @commitlint/cli
echo $commit | ./node_modules/.bin/commitlint -g .commitlintrc
php-cs-fixer:
name: PHP-cs-fixer (PHP ${{ matrix.php }})
runs-on: ubuntu-latest
Expand Down

0 comments on commit 8691fdf

Please sign in to comment.