Skip to content

Commit

Permalink
Update Artifact
Browse files Browse the repository at this point in the history
  • Loading branch information
stasadev committed May 16, 2024
1 parent c82367b commit 7bb1d33
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions .github/workflows/pr-artifacts-comment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,15 @@ jobs:
// get a PR number
const {owner, repo} = context.repo;
const pullHeadSHA = '${{github.event.workflow_run.head_sha}}';
const prNumber = await (async () => {
const {prNumber, prRef, prRepoId} = await (async () => {
for await (const {data} of github.paginate.iterator(github.rest.pulls.list, {owner, repo})) {
for (const pull of data) {
if (pull.head.sha === pullHeadSHA) {
return pull.number;
return {
prNumber: pull.number,
prRef: pull.head.ref,
prRepoId: pull.head.repo.id
};
}
}
}
Expand All @@ -55,8 +59,10 @@ jobs:
body += `\n\n See [Testing a PR](https://ddev.readthedocs.io/en/latest/developers/building-contributing/#testing-a-pr)` + `.`;
body += `\n\n[![Test on Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/?autostart=true#https://github.com/` + context.repo.owner + `/` + context.repo.repo + `/pull/` + prNumber + `)`;
body += `\n\n[![Test on GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/` + context.repo.owner + `/` + context.repo.repo + `/pull/` + prNumber + `)`;
body += `\n\n[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/` + context.repo.owner + `/` + context.repo.repo + `/pull/` + prNumber + `)`;
if (prRef && prRepoId) {
body += `\n\n[![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/?ref=` + prRef + `&repo=` + prRepoId + `)`;
}
// insert or update a bot comment
async function upsertComment(owner, repo, issue_number, purpose, body) {
Expand Down

0 comments on commit 7bb1d33

Please sign in to comment.