Skip to content

Commit 997d9e6

Browse files
authored
Merge pull request riscv#2689 from riscv/update-check-normative-tags-workflow
Update check-normative-tags.yml workflow
2 parents 2e467d9 + 96dc518 commit 997d9e6

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

.github/workflows/check-normative-tags.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,9 @@ jobs:
4545
- name: Checkout code
4646
uses: actions/checkout@v4
4747
with:
48-
ref: ${{ github.event.pull_request.head.sha || github.sha }}
48+
# Keep push/workflow_dispatch on a branch so later auto-commit can push.
49+
# For pull_request_target, analyze the PR head commit contents.
50+
ref: ${{ (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && github.ref || github.event.pull_request.head.sha }}
4951
submodules: recursive
5052

5153
- name: Build normative tags
@@ -135,8 +137,12 @@ jobs:
135137
git config --local user.email "github-actions[bot]@users.noreply.github.com"
136138
git config --local user.name "github-actions[bot]"
137139
git add ref/*.json
138-
git diff --staged --quiet || git commit -m "Auto-update normative tag reference files"
139-
git push
140+
if git diff --staged --quiet; then
141+
echo "No reference file changes to commit."
142+
exit 0
143+
fi
144+
git commit -m "Auto-update normative tag reference files"
145+
git push origin "HEAD:${GITHUB_REF#refs/heads/}"
140146
141147
- name: Comment on PR with detected changes
142148
if: >-

0 commit comments

Comments
 (0)