chore: Retry labeling release PRs

This commit is contained in:
Daniel Azuma 2020-11-02 21:16:35 +00:00
parent 90796c08c0
commit 04b3d2328c
1 changed files with 47 additions and 43 deletions

View File

@ -27,6 +27,9 @@ jobs:
with: with:
github-token: ${{secrets.YOSHI_APPROVER_TOKEN}} github-token: ${{secrets.YOSHI_APPROVER_TOKEN}}
script: | script: |
let found = false;
for (let tries = 3; tries > 0; tries--) {
await new Promise(r => setTimeout(r, 2000));
const prs = await github.pulls.list({ const prs = await github.pulls.list({
owner: 'googleapis', owner: 'googleapis',
repo: 'google-api-ruby-client', repo: 'google-api-ruby-client',
@ -35,7 +38,6 @@ jobs:
direction: 'desc', direction: 'desc',
per_page: 10 per_page: 10
}); });
var found = false;
prs.data.forEach(function(pr) { prs.data.forEach(function(pr) {
if (found || pr.user.login != "yoshi-code-bot" || !pr.title.startsWith("Release ")) { if (found || pr.user.login != "yoshi-code-bot" || !pr.title.startsWith("Release ")) {
return; return;
@ -67,7 +69,9 @@ jobs:
} }
core.info("AutoApprove: complete!"); core.info("AutoApprove: complete!");
found = true; found = true;
tries = 0;
}); });
if (!found) { }
core.setFailed("Unable to find release PR."); if (!found) {
core.setFailed("Unable to find release PR after 3 tries.");
} }