Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .github/workflows/auto-approve.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,21 @@ jobs:
return;
}

// Condition 0: never auto-approve a PR that changes the bot's own
// guardrails (workflows or engine config) — that lets a PR weaken
// the approval gate and be approved by the very gate it edits.
// Require a human for these.
const files = await github.paginate(github.rest.pulls.listFiles, {
owner, repo, pull_number: prNumber, per_page: 100
});
const guarded = files.find(f =>
f.filename.startsWith('.github/') || f.filename === '.shadow.yml'
);
if (guarded) {
core.info(`PR touches guarded path ${guarded.filename} — requires human review, skipping`);
return;
}

// Condition 1: CI must have passed for this SHA
const {data: workflowRuns} = await github.rest.actions.listWorkflowRunsForRepo({
owner, repo, head_sha: sha, status: 'completed'
Expand Down
Loading