Skip to content

Commit 575dc0d

Browse files
authored
github-action: support pull_request_target and pull_request events (#213)
1 parent 31c8fb2 commit 575dc0d

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

.github/workflows/bench-diff.yml

+7-7
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,20 @@ jobs:
1313
# Support for branches, non-forked-prs or forked-prs with a label
1414
if: |
1515
contains(github.event.pull_request.labels.*.name, 'safe-to-test') ||
16-
github.event_name != 'pull_request' ||
17-
(github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork == false)
16+
! startsWith(github.event_name, 'pull_request') ||
17+
(startsWith(github.event_name, 'pull_request') && github.event.pull_request.head.repo.fork == false)
1818
permissions:
1919
checks: write
2020
steps:
2121
- name: Get sha commit
2222
id: event
2323
run: |
2424
echo "DEBUG: event type(${{ github.event_name }})"
25-
if [ "${{ github.event_name != 'pull_request_target' }}" = "true" ] ; then
26-
echo "ref=${{ github.sha }}" >> "$GITHUB_OUTPUT"
27-
else
28-
echo "ref=${{ github.event.pull_request.head.sha }}" >> "$GITHUB_OUTPUT"
25+
ref="${{ github.sha }}"
26+
if [ "${{ startsWith(github.event_name, 'pull_request') }}" = "true" ] ; then
27+
ref="${{ github.event.pull_request.head.sha }}"
2928
fi
29+
echo "ref=${ref}" >> "$GITHUB_OUTPUT"
3030
- uses: actions/checkout@v4
3131
with:
3232
fetch-depth: 0
@@ -35,7 +35,7 @@ jobs:
3535
- uses: actions/setup-go@v5
3636
with:
3737
go-version-file: go.mod
38-
# Version: https://github.com/WillAbides/benchdiff-action/releases/tag/v0.3.3
38+
# Version: https://github.com/WillAbides/benchdiff-action/releases/tag/v0.3.5
3939
- uses: WillAbides/benchdiff-action@990b4c50b5420b485bf87e42c9f18234eba76fbc
4040
id: benchdiff
4141
with:

0 commit comments

Comments
 (0)