From 776ddd3b11c40abb4ea128fa30468adc65a33c99 Mon Sep 17 00:00:00 2001 From: Chris Novakovic Date: Mon, 18 Oct 2021 01:11:03 +0100 Subject: [PATCH] WIP: re-sequentialise releases API requests to avoid secondary rate-limiting --- .github/workflows/build.yml | 34 +++++++++++++++------------------- 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index edbc336..128702c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -24,32 +24,28 @@ jobs: require("fs").writeFileSync("releases.gh", JSON.stringify(releases)); - p = []; for (const r of releases) { if (r.target_commitish == context.sha) { console.log(`Strawberry Perl ${r.tag_name} (release ${r.id}): target commit hash up-to-date`); } else { console.log(`Strawberry Perl ${r.tag_name} (release ${r.id}): updating target commit hash`); - p.push( - github.rest.git.updateRef({ - owner: context.repo.owner, - repo: context.repo.repo, - ref: `tags/${r.tag_name}`, - sha: context.sha, - force: true, - }) - .then(_ => console.log(`Strawberry Perl ${r.tag_name} (release ${r.id}): updated tag commit hash`)), - github.rest.repos.updateRelease({ - owner: context.repo.owner, - repo: context.repo.repo, - release_id: r.id, - target_commitish: context.sha, - }) - .then(_ => console.log(`Strawberry Perl ${r.tag_name} (release ${r.id}): updated release commit hash`)), - ); + + await github.rest.git.updateRef({ + owner: context.repo.owner, + repo: context.repo.repo, + ref: `tags/${r.tag_name}`, + sha: context.sha, + force: true, + }); + + await github.rest.repos.updateRelease({ + owner: context.repo.owner, + repo: context.repo.repo, + release_id: r.id, + target_commitish: context.sha, + }); } } - await Promise.all(p); - name: Upload GitHub releases response as artifact uses: actions/upload-artifact@v2