Skip to content

Commit 4ff40ad

Browse files
fix(validate-pr): Allow trusted bots to bypass validation (#155)
* fix(validate-pr): Allow trusted bots and service accounts to bypass validation Adds an allowlist of trusted bots and service accounts that are exempt from issue reference validation. Prevents dependabot, renovate, and internal release bots from being automatically closed. The allowlist is managed centrally in validate-pr.js — SDK repos pick up changes via SHA bumps. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: Also skip draft enforcement for allowed bots Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 4243265 commit 4ff40ad

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

validate-pr/action.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ runs:
3737
- name: Convert PR to draft
3838
if: >-
3939
steps.validate.outputs.was-closed != 'true'
40+
&& steps.validate.outputs.skipped != 'true'
4041
&& github.event.pull_request.draft == false
4142
shell: bash
4243
env:
@@ -47,6 +48,7 @@ runs:
4748
- name: Label and comment on draft conversion
4849
if: >-
4950
steps.validate.outputs.was-closed != 'true'
51+
&& steps.validate.outputs.skipped != 'true'
5052
&& github.event.pull_request.draft == false
5153
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
5254
with:

validate-pr/scripts/validate-pr.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,22 @@ module.exports = async ({ github, context, core }) => {
1717
const prAuthor = pullRequest.user.login;
1818
const contributingUrl = `https://github.com/${repo.owner}/${repo.repo}/blob/${context.payload.repository.default_branch}/CONTRIBUTING.md`;
1919

20+
// --- Step 0: Skip allowed bots and service accounts ---
21+
const ALLOWED_BOTS = [
22+
'codecov-ai[bot]',
23+
'dependabot[bot]',
24+
'fix-it-felix-sentry[bot]',
25+
'getsentry-bot',
26+
'github-actions[bot]',
27+
'javascript-sdk-gitflow[bot]',
28+
'renovate[bot]',
29+
];
30+
if (ALLOWED_BOTS.includes(prAuthor)) {
31+
core.info(`PR author ${prAuthor} is an allowed bot. Skipping.`);
32+
core.setOutput('skipped', 'true');
33+
return;
34+
}
35+
2036
// --- Helper: check if a user has admin or maintain permission on a repo (cached) ---
2137
const maintainerCache = new Map();
2238
async function isMaintainer(owner, repoName, username) {

0 commit comments

Comments
 (0)