@@ -67,13 +67,14 @@ jobs:
6767 python -c "$modules"
6868
6969 pytester :
70- # skip PR trigger if secrets are not shared as for all forked PRs
70+ # Route PRs based on contributor type to avoid duplicate runs:
71+ # - Collaborators: use pull_request (tests workflow changes from PR)
72+ # - External forks: use pull_request_target (uses trusted workflow from main)
73+ # - Always run for push to main and workflow_dispatch
7174 if : |
72- github.event_name != 'pull_request' ||
73- (
74- github.event_name == 'pull_request' &&
75- contains('OWNER,MEMBER,COLLABORATOR', github.event.pull_request.author_association)
76- )
75+ (github.event_name == 'pull_request' && contains('OWNER,MEMBER,COLLABORATOR', github.event.pull_request.author_association)) ||
76+ (github.event_name == 'pull_request_target' && !contains('OWNER,MEMBER,COLLABORATOR', github.event.pull_request.author_association)) ||
77+ (github.event_name != 'pull_request' && github.event_name != 'pull_request_target')
7778 runs-on : ${{ matrix.os }}
7879 strategy :
7980 fail-fast : false
@@ -137,11 +138,8 @@ jobs:
137138 runs-on : ubuntu-latest
138139 needs : [pytester, testing-imports]
139140 if : |
140- github.event_name == 'pull_request_target' ||
141- (
142- github.event_name == 'pull_request' &&
143- contains('OWNER,MEMBER,COLLABORATOR', github.event.pull_request.author_association)
144- )
141+ (github.event_name == 'pull_request_target' && !contains('OWNER,MEMBER,COLLABORATOR', github.event.pull_request.author_association)) ||
142+ (github.event_name == 'pull_request' && contains('OWNER,MEMBER,COLLABORATOR', github.event.pull_request.author_association))
145143 steps :
146144 - run : echo "${{ needs.pytester.result }}"
147145 - name : failing...
0 commit comments