Skip to content

Commit

Permalink
ci: move "get commit messages" to "validate commit messages" step, im…
Browse files Browse the repository at this point in the history
…prove "pre-commit run" command and use "github.base_ref" instead "master"
  • Loading branch information
rsanchez87 committed Jan 24, 2025
1 parent ff8149c commit 397d149
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,14 @@ jobs:
- name: Install pre-commit hooks
run: pre-commit install

- name: Get all commit messages in the push
id: get_commit_messages
run: |
git fetch --prune --unshallow
git rev-list --no-merges origin/master..${{ github.sha }} > commits.txt
- name: Validate all commit messages
run: |
git fetch --prune --unshallow
git rev-list --no-merges origin/${{ github.base_ref }}..${{ github.sha }} > commits.txt
while read commit; do
echo "Validate commit: $commit"
git show -s --format=%B $commit > commit-msg.txt
pre-commit run --hook-stage commit-msg --commit-msg-filename commit-msg.txt --files commit-msg.txt || exit 1
pre-commit run conventional-pre-commit --hook-stage commit-msg --commit-msg-filename commit-msg.txt || exit 1
done < commits.txt
- name: Validate all files
Expand Down

0 comments on commit 397d149

Please sign in to comment.