Skip to content

Commit

Permalink
WIP: re-sequentialise releases API requests to avoid secondary rate-l…
Browse files Browse the repository at this point in the history
…imiting
  • Loading branch information
chrisnovakovic committed Oct 18, 2021
1 parent 1c5413e commit 776ddd3
Showing 1 changed file with 15 additions and 19 deletions.
34 changes: 15 additions & 19 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 776ddd3

Please sign in to comment.