fix(ci): trust dependency approvers before graph compare (#123456)

This commit is contained in:
Peter Steinberger
2026-08-13 21:03:34 -07:00
committed by GitHub
parent 860aeed8f6
commit 27c4433939
2 changed files with 24 additions and 22 deletions
+21 -21
View File
@@ -792,27 +792,6 @@ async function main() {
return;
}
const dependencyGraphChanges = await api.paginate(
`/repos/${owner}/${repo}/dependency-graph/compare/${pullRequest.base?.sha}...${pullRequest.head?.sha}`,
);
if (isRemovalOnlyDependencyGraphChange(dependencyGraphChanges)) {
if (mode === "detect") {
await setOutput("autoscrub", "false");
}
await upsertComment(
existingGuardComment,
renderRemovalOnlyDependencyComment({
dependencyGraphChanges,
headSha: pullRequest.head?.sha,
}),
);
await writeSummary(
"## Dependency Guard\n\nDependency removals are informational and do not require security approval.",
);
console.log("Dependency removals detected; guard is informational.");
return;
}
const { isSecurityMember, isRepositoryAdmin } = createGuardApproverChecks({
api,
owner,
@@ -867,6 +846,27 @@ async function main() {
return;
}
const dependencyGraphChanges = await api.paginate(
`/repos/${owner}/${repo}/dependency-graph/compare/${pullRequest.base?.sha}...${pullRequest.head?.sha}`,
);
if (isRemovalOnlyDependencyGraphChange(dependencyGraphChanges)) {
if (mode === "detect") {
await setOutput("autoscrub", "false");
}
await upsertComment(
existingGuardComment,
renderRemovalOnlyDependencyComment({
dependencyGraphChanges,
headSha: pullRequest.head?.sha,
}),
);
await writeSummary(
"## Dependency Guard\n\nDependency removals are informational and do not require security approval.",
);
console.log("Dependency removals detected; guard is informational.");
return;
}
const autoscrubCandidate = shouldAutoscrubDependencyLockfiles({
dependencyFiles,
lockfileChanges,