File tree 1 file changed +40
-0
lines changed
1 file changed +40
-0
lines changed Original file line number Diff line number Diff line change
1
+ name : Update PR Description
2
+
3
+ on :
4
+ pull_request :
5
+ types : [opened, synchronize]
6
+
7
+ jobs :
8
+ update-description :
9
+ runs-on : ubuntu-latest
10
+ steps :
11
+ - name : Checkout repository
12
+ uses : actions/checkout@v2
13
+
14
+ - name : Update PR description
15
+ uses : actions/github-script@v6
16
+ with :
17
+ github-token : ${{ secrets.GH_TOKEN }}
18
+ script : |
19
+ const prNumber = context.payload.pull_request.number;
20
+ const owner = context.payload.pull_request.head.repo.owner.login;
21
+ const repo = context.payload.pull_request.head.repo.name;
22
+ const commit = context.payload.pull_request.head.sha;
23
+ const link = `https://raw.githack.com/${owner}/${repo}/${commit}/kitchen-sink.html`;
24
+
25
+ const { data: pullRequest } = await github.rest.pulls.get({
26
+ owner: context.repo.owner,
27
+ repo: context.repo.repo,
28
+ pull_number: prNumber,
29
+ });
30
+
31
+ if (!pullRequest.body.includes(link)) {
32
+ const updatedBody = `${pullRequest.body}\n\n[View the changes](${link})`;
33
+
34
+ await github.rest.pulls.update({
35
+ owner: context.repo.owner,
36
+ repo: context.repo.repo,
37
+ pull_number: prNumber,
38
+ body: updatedBody,
39
+ });
40
+ }
You can’t perform that action at this time.
0 commit comments