File tree Expand file tree Collapse file tree 1 file changed +26
-1
lines changed Expand file tree Collapse file tree 1 file changed +26
-1
lines changed Original file line number Diff line number Diff line change @@ -14,8 +14,33 @@ permissions:
14
14
contents : read
15
15
16
16
jobs :
17
+ check_skip : # check for "[no benchmark]" in pr body
18
+ runs-on : ubuntu-latest
19
+ outputs :
20
+ skip : ${{ steps.check.outputs.skip_benchmark }}
21
+ steps :
22
+ - name : Fetch latest PR details
23
+ id : fetch-pr
24
+ run : |
25
+ PR_DATA=$(gh pr view ${{ github.event.pull_request.number }} --json body,title -q '{body: .body, title: .title}')
26
+ echo "PR_TITLE=$(echo $PR_DATA | jq -r '.title')" >> $GITHUB_ENV
27
+ echo "PR_BODY=$(echo $PR_DATA | jq -r '.body')" >> $GITHUB_ENV
28
+ env :
29
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
30
+ - name : Check for '[no benchmark]'
31
+ id : check
32
+ run : |
33
+ if [[ "$PR_TITLE" == *"[no benchmark]"* || "$PR_BODY" == *"[no benchmark]"* ]]; then
34
+ echo "Benchmarks will be skipped."
35
+ echo "skip_benchmark=true" >> $GITHUB_OUTPUT
36
+ else
37
+ echo "Benchmarks will run."
38
+ echo "skip_benchmark=false" >> $GITHUB_OUTPUT
39
+ fi
40
+
17
41
run_benchmarks :
18
- if : " !contains(github.event.pull_request.title, '[no benchmark]') && !contains(github.event.pull_request.body, '[no benchmark]')"
42
+ needs : check_skip
43
+ if : needs.check_skip.outputs.skip == 'false' # Skip the job if '[no benchmark]' is found
19
44
runs-on : ubuntu-latest
20
45
steps :
21
46
- uses : actions/checkout@v4
You can’t perform that action at this time.
0 commit comments