From 8ed455851f6e275b85a3d2a2c77cabfbfe9052ca Mon Sep 17 00:00:00 2001 From: gregfromstl Date: Fri, 13 Dec 2024 13:37:54 -0800 Subject: [PATCH] chore: only run actions for thirdweb people --- .github/workflows/auto-assign.yml | 19 +++++++++++++++++-- .github/workflows/issue.yml | 13 ++++++++++++- 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/.github/workflows/auto-assign.yml b/.github/workflows/auto-assign.yml index 0c78598d065..45a0a857354 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, ready_for_review ] permissions: pull-requests: write @@ -11,4 +11,19 @@ jobs: assign-author: runs-on: ubuntu-latest steps: - - uses: toshimaru/auto-author-assign@v2.1.1 + - name: Check contributor status and assign author + uses: actions/github-script@v7 + with: + script: | + const isInternalContributor = ['MEMBER', 'OWNER', 'COLLABORATOR'].includes( + context.payload.pull_request.author_association + ); + + if (!isInternalContributor) { + console.log('External contributor detected - skipping author assignment'); + return; + } + + // Use the auto-assign action only for internal contributors + const { exec } = require('child_process'); + exec('npx @toshimaru/auto-author-assign'); 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');