Skip to content

Commit 639a443

Browse files
committed
ci manual trigger update
Signed-off-by: Mohammed Abdi <mohammed.munir.abdi@ibm.com>
1 parent 21c173b commit 639a443

1 file changed

Lines changed: 46 additions & 4 deletions

File tree

.github/workflows/ci-pr-checks.yaml

Lines changed: 46 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,41 @@ jobs:
2929
runs-on: ubuntu-latest
3030
permissions:
3131
contents: read
32+
pull-requests: read # For reading PR details when triggered via issue_comment
3233
outputs:
33-
has_code_changes: ${{ steps.filter.outputs.code }}
34+
has_code_changes: ${{ steps.set-output.outputs.has_code_changes }}
3435
steps:
36+
- name: Get PR number for issue_comment events
37+
id: pr-info
38+
if: github.event_name == 'issue_comment'
39+
uses: actions/github-script@v7
40+
with:
41+
script: |
42+
const issue = context.payload.issue;
43+
if (!issue.pull_request) {
44+
core.setOutput('pr_number', '');
45+
return;
46+
}
47+
const { data: pr } = await github.rest.pulls.get({
48+
owner: context.repo.owner,
49+
repo: context.repo.repo,
50+
pull_number: issue.number
51+
});
52+
core.setOutput('pr_number', issue.number.toString());
53+
core.setOutput('pr_head_sha', pr.head.sha);
54+
3555
- name: Checkout source
3656
uses: actions/checkout@v4
57+
with:
58+
# For issue_comment events, checkout the PR head SHA
59+
ref: ${{ github.event_name == 'issue_comment' && steps.pr-info.outputs.pr_head_sha || github.event.pull_request.head.sha || github.sha }}
60+
# For pull_request events, fetch the PR head
61+
fetch-depth: 0
3762

3863
- name: Check for code changes
3964
uses: dorny/paths-filter@v3
4065
id: filter
66+
continue-on-error: true # Don't fail if paths-filter can't determine changes (e.g., issue_comment without PR context)
4167
with:
4268
filters: |
4369
code:
@@ -47,6 +73,20 @@ jobs:
4773
- '!LICENSE'
4874
- '!OWNERS'
4975
- '!PROJECT'
76+
77+
- name: Set output with default
78+
id: set-output
79+
run: |
80+
# Use filter output if available, otherwise default to 'true' for issue_comment events
81+
# This ensures /trigger-e2e-full works even if PR context is unclear
82+
FILTER_OUTPUT="${{ steps.filter.outputs.code }}"
83+
if [ "${{ github.event_name }}" == "issue_comment" ] && [ -z "$FILTER_OUTPUT" ]; then
84+
echo "has_code_changes=true" >> $GITHUB_OUTPUT
85+
elif [ -n "$FILTER_OUTPUT" ]; then
86+
echo "has_code_changes=$FILTER_OUTPUT" >> $GITHUB_OUTPUT
87+
else
88+
echo "has_code_changes=true" >> $GITHUB_OUTPUT
89+
fi
5090
5191
lint-and-test:
5292
runs-on: ubuntu-latest
@@ -186,13 +226,15 @@ jobs:
186226
core.setOutput('run_full', 'false');
187227
188228
# E2E tests - smoke tests run automatically, full tests on approval
189-
# Skip e2e tests if PR only contains docs/metadata changes
229+
# Skip e2e tests if PR only contains docs/metadata changes (unless explicitly triggered via /trigger-e2e-full)
190230
e2e-tests:
191231
runs-on: ubuntu-latest
192232
needs: [lint-and-test, check-code-changes, check-full-tests]
193233
if: |
194-
needs.check-code-changes.outputs.has_code_changes == 'true' ||
195-
needs.check-full-tests.outputs.run_full == 'true'
234+
# Always run if explicitly triggered via /trigger-e2e-full or workflow_dispatch
235+
needs.check-full-tests.outputs.run_full == 'true' ||
236+
# Otherwise, only run if PR has code changes
237+
needs.check-code-changes.outputs.has_code_changes == 'true'
196238
timeout-minutes: 60
197239
permissions:
198240
contents: read

0 commit comments

Comments
 (0)