/.github/workflows/bump-dependency.yaml: only keep single bump pr open at a time

This commit is contained in:
coffeegoddd
2022-08-17 12:33:02 -07:00
parent 103a1ed17a
commit b5af09cd00

View File

@@ -166,41 +166,20 @@ jobs:
if (pull.keepAlive) process.exit(0);
const checkSuiteRes = await github.checks.listSuitesForRef({
console.log(`Closing open pr ${pull.number}`);
await github.issues.createComment({
issue_number: pull.number,
owner,
repo,
ref: pull.headRef,
body: `This PR has been superseded by ${SUPERSEDED_BY}`
});
if (checkSuiteRes.data) {
for (const suite of checkSuiteRes.data.check_suites) {
console.log("suite id:", suite.id);
console.log("suite app slug:", suite.app.slug);
console.log("suite status:", suite.status);
console.log("suite conclusion:", suite.conclusion);
if (suite.app.slug === "github-actions") {
if (suite.status !== "completed" || suite.conclusion !== "success") {
console.log(`Leaving pr open due to status:${suite.status} conclusion${suite.conclusion}`);
process.exit(0);
}
}
}
console.log(`Closing open pr ${pull.number}`);
await github.issues.createComment({
issue_number: pull.number,
owner,
repo,
body: `This PR has been superseded by ${SUPERSEDED_BY}`
});
await github.pulls.update({
owner,
repo,
pull_number: pull.number,
state: 'closed',
});
}
await github.pulls.update({
owner,
repo,
pull_number: pull.number,
state: 'closed',
});
process.exit(0);
} catch(err) {