-
Notifications
You must be signed in to change notification settings - Fork 157
41 lines (38 loc) · 1.25 KB
/
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
name: Comment on PR
on:
workflow_run:
workflows: ["SHASUM summary"]
types:
- completed
jobs:
comment:
permissions:
pull-requests: write
runs-on: ubuntu-latest
if: >
github.event.workflow_run.event == 'pull_request' &&
github.event.workflow_run.conclusion == 'success'
steps:
- name: download artifact
uses: actions/download-artifact@v4
with:
name: shasum-comment
github-token: ${{ secrets.GITHUB_TOKEN }}
repository: ${{ github.repository }}
run-id: ${{ github.event.workflow_run.id }}
- name: comment
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const fs = require('fs');
let issue_number = Number(fs.readFileSync('./issue-number', 'utf8').trim());
let comment = fs.readFileSync('./comment', 'utf8').trim();
if (comment.length > 0) {
github.rest.issues.createComment({
issue_number: issue_number,
owner: context.repo.owner,
repo: context.repo.repo,
body: "${{ github.event.pull_request.head.sha }}\n\n" + comment
});
}