Skip to content

Commit dc1e07b

Browse files
committed
[CI] Chore: Only run actions for contributors (#5739)
## Problem solved Short description of the bug fixed or feature added <!-- start pr-codex --> --- ## PR-Codex overview This PR enhances the GitHub workflows for pull requests by adding conditions for author associations and expanding issue types. ### Detailed summary - In `.github/workflows/auto-assign.yml`, added checks to assign authors only if they are `MEMBER`, `OWNER`, or `COLLABORATOR`. - In `.github/workflows/issue.yml`, expanded the `types` to include `ready_for_review`. - Added logic to automatically pass checks for external contributors. > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` <!-- end pr-codex -->
1 parent 2b5080d commit dc1e07b

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

.github/workflows/auto-assign.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,17 @@ name: Auto Author Assign
22

33
on:
44
pull_request:
5-
types: [ opened, reopened ]
5+
types: [opened, reopened]
66

77
permissions:
88
pull-requests: write
99

1010
jobs:
1111
assign-author:
1212
runs-on: ubuntu-latest
13+
if: |
14+
github.event.pull_request.author_association == 'MEMBER' ||
15+
github.event.pull_request.author_association == 'OWNER' ||
16+
github.event.pull_request.author_association == 'COLLABORATOR'
1317
steps:
1418
- uses: toshimaru/auto-author-assign@v2.1.1

.github/workflows/issue.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Linked Issue
22

33
on:
44
pull_request:
5-
types: [opened, edited]
5+
types: [opened, edited, ready_for_review]
66

77
env:
88
VALID_ISSUE_PREFIXES: "CNCT|DASH|PROT|INSIGHT|ENGINE|CS|DES|BIL|DEVX|SOLU|NEB"
@@ -22,6 +22,17 @@ jobs:
2222
pull_number: context.issue.number
2323
});
2424
25+
// Check if contributor is external
26+
const isInternalContributor = ['MEMBER', 'OWNER', 'COLLABORATOR'].includes(
27+
context.payload.pull_request.author_association
28+
);
29+
30+
// Automatically pass for external contributors
31+
if (!isInternalContributor) {
32+
console.log('External contributor detected - automatically passing check');
33+
return;
34+
}
35+
2536
const body = pr.data.body || '';
2637
const branchName = pr.data.head.ref;
2738
const issueRegex = new RegExp(`(${process.env.VALID_ISSUE_PREFIXES})-\\d+`, 'i');

0 commit comments

Comments
 (0)