diff --git a/.github/workflows/pr-artifacts-comment.yml b/.github/workflows/pr-artifacts-comment.yml index 26b0626..d740fd6 100644 --- a/.github/workflows/pr-artifacts-comment.yml +++ b/.github/workflows/pr-artifacts-comment.yml @@ -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 + }; } } } @@ -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) {