-
Notifications
You must be signed in to change notification settings - Fork 126
63 lines (51 loc) · 2.1 KB
/
write-prerelease-comment.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
name: Write prerelease comment
on:
workflow_run:
workflows: ['Create Pull Request Prerelease']
types:
- completed
jobs:
comment:
if: ${{ github.repository_owner == 'cloudflare' }}
runs-on: ubuntu-latest
name: Write comment to the PR
steps:
- name: 'Put PR and workflow ID on the environment'
uses: actions/github-script@v5
with:
script: |
const allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: context.payload.workflow_run.id,
});
for (const artifact of allArtifacts.data.artifacts) {
// Extract the PR number from the artifact name
const match = /^npm-package-next-on-pages-(\d+)$/.exec(artifact.name);
if (match) {
require("fs").appendFileSync(
process.env.GITHUB_ENV,
`\nWORKFLOW_RUN_PR=${match[1]}` +
`\nWORKFLOW_RUN_ID=${context.payload.workflow_run.id}`
);
break;
}
}
- name: 'Comment on PR with Link'
uses: marocchino/sticky-pull-request-comment@v2
with:
number: ${{ env.WORKFLOW_RUN_PR }}
message: |
🧪 Prereleases are available for testing 🧪
<details>
## @cloudflare/next-on-pages
You can install this latest build in your project with:
```sh
npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/next-on-pages/runs/${{ env.WORKFLOW_RUN_ID }}/npm-package-next-on-pages-${{ env.WORKFLOW_RUN_PR }}
```
## @cloudflare/eslint-plugin-next-on-pages
You can install this latest build in your project with:
```sh
npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/next-on-pages/runs/${{ env.WORKFLOW_RUN_ID }}/npm-package-eslint-plugin-next-on-pages-${{ env.WORKFLOW_RUN_PR }}
```
</details>