-
Notifications
You must be signed in to change notification settings - Fork 11
52 lines (40 loc) · 1.37 KB
/
review-app-comment.yml
File metadata and controls
52 lines (40 loc) · 1.37 KB
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
name: Comment Review App URL
on:
pull_request:
types: [opened, synchronize]
permissions:
pull-requests: write
issues: write
jobs:
comment:
runs-on: ubuntu-latest
steps:
- name: Wait for Heroku deployment
run: sleep 30
- name: Comment PR with Review App URL
uses: actions/github-script@v7
with:
script: |
const prNumber = context.payload.pull_request.number;
const comments = await github.rest.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: prNumber,
});
const botComment = comments.data.find(c =>
c.body.includes('Review App Preview')
);
const body = `## 🔍 Review App Preview
A Heroku Review App is being deployed for this PR.
**View your preview:** Check the [Heroku Pipeline](https://dashboard.heroku.com/pipelines/kernelboard) for the review app URL.
> The review app may take a few minutes to build after pushing.`;
if (botComment) {
// Don't update if already commented
return;
}
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: prNumber,
body: body
});