diff --git a/validate-pr/action.yml b/validate-pr/action.yml index d95a3cf..834b210 100644 --- a/validate-pr/action.yml +++ b/validate-pr/action.yml @@ -37,6 +37,7 @@ runs: - name: Convert PR to draft if: >- steps.validate.outputs.was-closed != 'true' + && steps.validate.outputs.skipped != 'true' && github.event.pull_request.draft == false shell: bash env: @@ -47,6 +48,7 @@ runs: - name: Label and comment on draft conversion if: >- steps.validate.outputs.was-closed != 'true' + && steps.validate.outputs.skipped != 'true' && github.event.pull_request.draft == false uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 with: diff --git a/validate-pr/scripts/validate-pr.js b/validate-pr/scripts/validate-pr.js index 428a2c2..80af37a 100644 --- a/validate-pr/scripts/validate-pr.js +++ b/validate-pr/scripts/validate-pr.js @@ -17,6 +17,22 @@ module.exports = async ({ github, context, core }) => { const prAuthor = pullRequest.user.login; const contributingUrl = `https://github.com/${repo.owner}/${repo.repo}/blob/${context.payload.repository.default_branch}/CONTRIBUTING.md`; + // --- Step 0: Skip allowed bots and service accounts --- + const ALLOWED_BOTS = [ + 'codecov-ai[bot]', + 'dependabot[bot]', + 'fix-it-felix-sentry[bot]', + 'getsentry-bot', + 'github-actions[bot]', + 'javascript-sdk-gitflow[bot]', + 'renovate[bot]', + ]; + if (ALLOWED_BOTS.includes(prAuthor)) { + core.info(`PR author ${prAuthor} is an allowed bot. Skipping.`); + core.setOutput('skipped', 'true'); + return; + } + // --- Helper: check if a user has admin or maintain permission on a repo (cached) --- const maintainerCache = new Map(); async function isMaintainer(owner, repoName, username) {