Skip to content

Commit 8499fba

Browse files
authored
Fixed GitHub Action that checks commit prefixes to fetch PR head correctly.
1 parent 40d6eb2 commit 8499fba

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

.github/workflows/check-commit-messages.yml renamed to .github/workflows/check_commit_messages.yml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@ jobs:
1919
id: vars
2020
run: |
2121
BASE="${{ github.event.pull_request.base.ref }}"
22-
HEAD="${{ github.event.pull_request.head.ref }}"
2322
echo "BASE=$BASE" >> $GITHUB_ENV
24-
echo "HEAD=$HEAD" >> $GITHUB_ENV
2523
VERSION="${BASE#stable/}"
2624
echo "prefix=[$VERSION]" >> $GITHUB_OUTPUT
2725
@@ -35,15 +33,15 @@ jobs:
3533
fi
3634
echo "✅ PR title has the required prefix."
3735
38-
- name: Fetch base and head branches
36+
- name: Fetch relevant branches
3937
run: |
40-
git fetch origin $BASE
41-
git fetch origin $HEAD
38+
git fetch origin $BASE:base
39+
git fetch origin pull/${{ github.event.pull_request.number }}/head:pr
4240
4341
- name: Check commit messages prefix
4442
run: |
4543
PREFIX="${{ steps.vars.outputs.prefix }}"
46-
COMMITS=$(git rev-list origin/${BASE}..origin/${HEAD})
44+
COMMITS=$(git rev-list base..pr)
4745
echo "Checking commit messages for required prefix: $PREFIX"
4846
FAIL=0
4947
for SHA in $COMMITS; do

0 commit comments

Comments
 (0)