Skip to content

Commit b9d243a

Browse files
Update .github/workflows/actionlint.yml
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
1 parent bc9bfc8 commit b9d243a

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

.github/workflows/actionlint.yml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,19 @@ jobs:
3333
- name: Check GitHub Action changes
3434
id: check-workflows
3535
run: |
36-
git fetch origin ${{ github.event.pull_request.base.sha }}
37-
if git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.sha }} | grep -q '^.github/workflows'; then
36+
BASE_SHA="${{ github.event.pull_request.base.sha || github.event.before }}"
37+
if [ -n "$BASE_SHA" ]; then
38+
git fetch origin "$BASE_SHA" 2>/dev/null || true
39+
fi
40+
41+
# For PRs, diff against base; for pushes, use before commit
42+
if [ -n "${{ github.event.pull_request.base.sha }}" ]; then
43+
DIFF_BASE="${{ github.event.pull_request.base.sha }}"
44+
else
45+
DIFF_BASE="${{ github.event.before }}"
46+
fi
47+
48+
if git diff --name-only "$DIFF_BASE" ${{ github.sha }} 2>/dev/null | grep -q '^.github/workflows'; then
3849
echo "changed=true" >> "$GITHUB_OUTPUT"
3950
response=$(curl -sf https://api.github.com/repos/rhysd/actionlint/releases/latest)
4051
if [ $? -eq 0 ]; then

0 commit comments

Comments
 (0)