From dc1e07b5e47af69d2a35ab426c36cab77da98796 Mon Sep 17 00:00:00 2001 From: gregfromstl Date: Sat, 14 Dec 2024 17:38:50 +0000 Subject: [PATCH] [CI] Chore: Only run actions for contributors (#5739) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Problem solved Short description of the bug fixed or feature added --- ## 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}` --- .github/workflows/auto-assign.yml | 6 +++++- .github/workflows/issue.yml | 13 ++++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/.github/workflows/auto-assign.yml b/.github/workflows/auto-assign.yml index 0c78598d065..8d08b73452e 100644 --- a/.github/workflows/auto-assign.yml +++ b/.github/workflows/auto-assign.yml @@ -2,7 +2,7 @@ name: Auto Author Assign on: pull_request: - types: [ opened, reopened ] + types: [opened, reopened] permissions: pull-requests: write @@ -10,5 +10,9 @@ permissions: jobs: assign-author: runs-on: ubuntu-latest + if: | + github.event.pull_request.author_association == 'MEMBER' || + github.event.pull_request.author_association == 'OWNER' || + github.event.pull_request.author_association == 'COLLABORATOR' steps: - uses: toshimaru/auto-author-assign@v2.1.1 diff --git a/.github/workflows/issue.yml b/.github/workflows/issue.yml index 661d5e2ab4d..3e8dd3623fa 100644 --- a/.github/workflows/issue.yml +++ b/.github/workflows/issue.yml @@ -2,7 +2,7 @@ name: Linked Issue on: pull_request: - types: [opened, edited] + types: [opened, edited, ready_for_review] env: VALID_ISSUE_PREFIXES: "CNCT|DASH|PROT|INSIGHT|ENGINE|CS|DES|BIL|DEVX|SOLU|NEB" @@ -22,6 +22,17 @@ jobs: pull_number: context.issue.number }); + // Check if contributor is external + const isInternalContributor = ['MEMBER', 'OWNER', 'COLLABORATOR'].includes( + context.payload.pull_request.author_association + ); + + // Automatically pass for external contributors + if (!isInternalContributor) { + console.log('External contributor detected - automatically passing check'); + return; + } + const body = pr.data.body || ''; const branchName = pr.data.head.ref; const issueRegex = new RegExp(`(${process.env.VALID_ISSUE_PREFIXES})-\\d+`, 'i');