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