File tree Expand file tree Collapse file tree 1 file changed +39
-0
lines changed
Expand file tree Collapse file tree 1 file changed +39
-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+ script : |
18+ const prNumber = context.payload.pull_request.number;
19+ const owner = context.payload.pull_request.head.repo.owner.login;
20+ const repo = context.payload.pull_request.head.repo.name;
21+ const commit = context.payload.pull_request.head.sha;
22+ const link = `https://raw.githack.com/${owner}/${repo}/${commit}/kitchen-sink.html`;
23+
24+ const { data: pullRequest } = await github.rest.pulls.get({
25+ owner: context.repo.owner,
26+ repo: context.repo.repo,
27+ pull_number: prNumber,
28+ });
29+
30+ if (!pullRequest.body.includes(link)) {
31+ const updatedBody = `${pullRequest.body}\n\n[View the changes](${link})`;
32+
33+ await github.rest.pulls.update({
34+ owner: context.repo.owner,
35+ repo: context.repo.repo,
36+ pull_number: prNumber,
37+ body: updatedBody,
38+ });
39+ }
You can’t perform that action at this time.
0 commit comments