|
52 | 52 | pull-requests: read # For reading PR details when triggered via issue_comment |
53 | 53 | outputs: |
54 | 54 | has_code_changes: ${{ steps.set-output.outputs.has_code_changes }} |
55 | | - pr_head_sha: ${{ steps.pr-info.outputs.pr_head_sha }} |
56 | 55 | steps: |
57 | 56 | - name: Get PR number for issue_comment events |
58 | 57 | id: pr-info |
@@ -109,10 +108,7 @@ jobs: |
109 | 108 | echo "has_code_changes=true" >> $GITHUB_OUTPUT |
110 | 109 | fi |
111 | 110 |
|
112 | | - # lint-and-test already runs on pull_request events; skip for issue_comment |
113 | | - # to avoid untrusted commenters triggering execution of PR code |
114 | 111 | lint-and-test: |
115 | | - if: github.event_name != 'issue_comment' |
116 | 112 | runs-on: ubuntu-latest |
117 | 113 | steps: |
118 | 114 | - name: Checkout source |
@@ -254,32 +250,13 @@ jobs: |
254 | 250 | e2e-tests: |
255 | 251 | runs-on: ubuntu-latest |
256 | 252 | needs: [lint-and-test, check-code-changes, check-full-tests] |
257 | | - if: >- |
258 | | - always() && ( |
259 | | - (github.event_name == 'issue_comment' && needs.check-full-tests.outputs.run_full == 'true' && needs.check-code-changes.result == 'success') || |
260 | | - (github.event_name == 'workflow_dispatch' && ( |
261 | | - needs.check-full-tests.outputs.run_full == 'true' || |
262 | | - (needs.check-code-changes.result == 'success' && needs.check-code-changes.outputs.has_code_changes == 'true') |
263 | | - )) || |
264 | | - (github.event_name == 'pull_request' && needs.check-code-changes.result == 'success' && needs.check-code-changes.outputs.has_code_changes == 'true') |
265 | | - ) |
| 253 | + if: always() && (needs.check-full-tests.outputs.run_full == 'true' || (needs.check-code-changes.result == 'success' && needs.check-code-changes.outputs.has_code_changes == 'true')) |
266 | 254 | timeout-minutes: 60 |
267 | 255 | permissions: |
268 | 256 | contents: read |
269 | 257 | steps: |
270 | | - - name: Validate PR head SHA for issue_comment events |
271 | | - if: github.event_name == 'issue_comment' |
272 | | - run: | |
273 | | - if [ -z "${{ needs.check-code-changes.outputs.pr_head_sha }}" ]; then |
274 | | - echo "::error::pr_head_sha is empty — refusing to fall back to main" |
275 | | - exit 1 |
276 | | - fi |
277 | | - echo "Checkout will use PR head SHA: ${{ needs.check-code-changes.outputs.pr_head_sha }}" |
278 | | -
|
279 | 258 | - name: Checkout source |
280 | 259 | uses: actions/checkout@v4 |
281 | | - with: |
282 | | - ref: ${{ needs.check-code-changes.outputs.pr_head_sha || '' }} |
283 | 260 |
|
284 | 261 | - name: Extract Go version from go.mod |
285 | 262 | run: sed -En 's/^go (.*)$/GO_VERSION=\1/p' go.mod >> $GITHUB_ENV |
|
0 commit comments