11name : ' Benchmark'
22
33on :
4- # Trigger when Test Suite completes (no polling needed)
5- workflow_run :
6- workflows : ["Test Suite"]
7- types : [completed]
4+ pull_request :
5+ pull_request_review :
6+ types : [submitted]
87 workflow_dispatch :
98
109concurrency :
11- group : ${{ github.workflow }}-${{ github.event.workflow_run.head_branch || github. ref }}
10+ group : ${{ github.workflow }}-${{ github.ref }}
1211 cancel-in-progress : true
1312
1413jobs :
1514 file-changes :
1615 name : Detect File Changes
17- # Only run if Test Suite passed (or manual dispatch)
18- if : github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success'
1916 runs-on : ' ubuntu-latest'
2017 outputs :
2118 checkall : ${{ steps.changes.outputs.checkall }}
22- pr_number : ${{ steps.pr-info.outputs.pr_number }}
23- pr_approved : ${{ steps.pr-info.outputs.approved }}
24- pr_author : ${{ steps.pr-info.outputs.author }}
2519 steps :
2620 - name : Clone
2721 uses : actions/checkout@v4
28- with :
29- ref : ${{ github.event.workflow_run.head_sha || github.sha }}
3022
3123 - name : Detect Changes
3224 uses : dorny/paths-filter@v3
3325 id : changes
3426 with :
3527 filters : " .github/file-filter.yml"
3628
37- - name : Get PR Info
38- id : pr-info
39- env :
40- GH_TOKEN : ${{ github.token }}
41- run : |
42- if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
43- echo "pr_number=" >> $GITHUB_OUTPUT
44- echo "approved=true" >> $GITHUB_OUTPUT
45- echo "author=${{ github.actor }}" >> $GITHUB_OUTPUT
46- else
47- # Get PR number from workflow_run
48- PR_NUMBER="${{ github.event.workflow_run.pull_requests[0].number }}"
49- if [ -n "$PR_NUMBER" ]; then
50- echo "pr_number=$PR_NUMBER" >> $GITHUB_OUTPUT
51-
52- # Fetch actual PR author from API (workflow_run.actor is the re-runner, not PR author)
53- PR_AUTHOR=$(gh api repos/${{ github.repository }}/pulls/$PR_NUMBER --jq '.user.login')
54- echo "author=$PR_AUTHOR" >> $GITHUB_OUTPUT
55-
56- # Check if PR is approved
57- APPROVED=$(gh api repos/${{ github.repository }}/pulls/$PR_NUMBER/reviews \
58- --jq '[.[] | select(.state == "APPROVED")] | length')
59- if [ "$APPROVED" -gt 0 ]; then
60- echo "approved=true" >> $GITHUB_OUTPUT
61- else
62- echo "approved=false" >> $GITHUB_OUTPUT
63- fi
64- else
65- echo "pr_number=" >> $GITHUB_OUTPUT
66- echo "approved=false" >> $GITHUB_OUTPUT
67- echo "author=" >> $GITHUB_OUTPUT
68- fi
69- fi
70-
7129 self :
7230 name : " ${{ matrix.name }} (${{ matrix.device }}${{ matrix.interface != 'none' && format('-{0}', matrix.interface) || '' }})"
73- if : >
74- github.repository == 'MFlowCode/MFC' &&
75- needs.file-changes.outputs.checkall == 'true' &&
76- (
77- github.event_name == 'workflow_dispatch' ||
78- needs.file-changes.outputs.pr_approved == 'true' ||
79- needs.file-changes.outputs.pr_author == 'sbryngelson' ||
80- needs.file-changes.outputs.pr_author == 'wilfonba'
81- )
82- needs : [file-changes]
31+ if : ${{ github.repository=='MFlowCode/MFC' && needs.file-changes.outputs.checkall=='true' && ((github.event_name=='pull_request_review' && github.event.review.state=='approved') || (github.event_name=='pull_request' && (github.event.pull_request.user.login=='sbryngelson' || github.event.pull_request.user.login=='wilfonba')) || github.event_name=='workflow_dispatch') }}
32+ needs : file-changes
8333 strategy :
8434 fail-fast : false
8535 matrix :
14393 - name : Clone - PR
14494 uses : actions/checkout@v4
14595 with :
146- ref : ${{ github.event.workflow_run.head_sha || github.sha }}
14796 path : pr
14897
14998 - name : Clone - Master
@@ -155,7 +104,7 @@ jobs:
155104
156105 - name : Setup & Build
157106 if : matrix.build_script != ''
158- run : |
107+ run : |
159108 (cd pr && ${{ matrix.build_script }}) &
160109 (cd master && ${{ matrix.build_script }}) &
161110 wait %1 && wait %2
0 commit comments