Compare commits

..

5 Commits

View File

@@ -29,22 +29,12 @@ jobs:
with: with:
script: | script: |
const sha = context.sha; const sha = context.sha;
// Squash-merge -> PR association is eventually-consistent; poll briefly const { data: prs } = await github.rest.repos.listPullRequestsAssociatedWithCommit({
// before concluding this was a direct push (avoids false positives on merges). owner: context.repo.owner,
async function findMergedPR() { repo: context.repo.repo,
for (let attempt = 1; attempt <= 5; attempt++) { commit_sha: sha,
const { data: prs } = await github.rest.repos.listPullRequestsAssociatedWithCommit({ });
owner: context.repo.owner, const merged = prs.find(p => p.merged_at);
repo: context.repo.repo,
commit_sha: sha,
});
const m = prs.find(p => p.merged_at);
if (m) return m;
if (attempt < 5) await new Promise(r => setTimeout(r, 10000));
}
return null;
}
const merged = await findMergedPR();
if (merged) { if (merged) {
core.info(`OK: commit ${sha.substring(0,7)} came from PR #${merged.number}`); core.info(`OK: commit ${sha.substring(0,7)} came from PR #${merged.number}`);
return; return;