Skip to content

Commit 3f006c1

Browse files
committed
fix: handle workflow_dispatch in source check step
- Add bypass logic for manual workflow_dispatch triggers on revamp branch - Prevents workflow from skipping when manually triggered for testing - Maintains security checks for workflow_run events
1 parent 75bccfa commit 3f006c1

File tree

1 file changed

+34
-19
lines changed

1 file changed

+34
-19
lines changed

.github/workflows/sync_docs_execute.yml

Lines changed: 34 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -29,26 +29,41 @@ jobs:
2929
id: check-source
3030
run: |
3131
echo "Checking workflow source..."
32-
echo "Event: ${{ github.event.workflow_run.event }}"
33-
echo "Repository: ${{ github.event.workflow_run.repository.full_name }}"
34-
echo "Head Repository: ${{ github.event.workflow_run.head_repository.full_name }}"
35-
echo "Head Branch: ${{ github.event.workflow_run.head_branch }}"
36-
37-
# Security check: Only process PRs from the same repository or trusted forks
38-
if [[ "${{ github.event.workflow_run.event }}" != "pull_request" ]]; then
39-
echo "Not a pull request event, skipping"
40-
echo "should_process=false" >> $GITHUB_OUTPUT
41-
exit 0
42-
fi
43-
44-
# Check if this is from a fork
45-
IS_FORK="false"
46-
if [[ "${{ github.event.workflow_run.repository.full_name }}" != "${{ github.event.workflow_run.head_repository.full_name }}" ]]; then
47-
IS_FORK="true"
32+
echo "Event name: ${{ github.event_name }}"
33+
34+
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
35+
# Manual trigger - bypass source checks for revamp branch
36+
if [[ "${{ github.ref }}" == "refs/heads/revamp" ]]; then
37+
echo "Manual workflow_dispatch on revamp branch - proceeding"
38+
echo "is_fork=false" >> $GITHUB_OUTPUT
39+
echo "should_process=true" >> $GITHUB_OUTPUT
40+
else
41+
echo "Manual workflow_dispatch not on revamp branch - skipping"
42+
echo "should_process=false" >> $GITHUB_OUTPUT
43+
fi
44+
else
45+
# workflow_run event - use existing logic
46+
echo "Event: ${{ github.event.workflow_run.event }}"
47+
echo "Repository: ${{ github.event.workflow_run.repository.full_name }}"
48+
echo "Head Repository: ${{ github.event.workflow_run.head_repository.full_name }}"
49+
echo "Head Branch: ${{ github.event.workflow_run.head_branch }}"
50+
51+
# Security check: Only process PRs from the same repository or trusted forks
52+
if [[ "${{ github.event.workflow_run.event }}" != "pull_request" ]]; then
53+
echo "Not a pull request event, skipping"
54+
echo "should_process=false" >> $GITHUB_OUTPUT
55+
exit 0
56+
fi
57+
58+
# Check if this is from a fork
59+
IS_FORK="false"
60+
if [[ "${{ github.event.workflow_run.repository.full_name }}" != "${{ github.event.workflow_run.head_repository.full_name }}" ]]; then
61+
IS_FORK="true"
62+
fi
63+
64+
echo "is_fork=$IS_FORK" >> $GITHUB_OUTPUT
65+
echo "should_process=true" >> $GITHUB_OUTPUT
4866
fi
49-
50-
echo "is_fork=$IS_FORK" >> $GITHUB_OUTPUT
51-
echo "should_process=true" >> $GITHUB_OUTPUT
5267
5368
- name: Download analysis artifacts
5469
if: steps.check-source.outputs.should_process == 'true'

0 commit comments

Comments
 (0)