Skip to content

Commit 2699926

Browse files
authored
Create comment.yml
1 parent 7b075a8 commit 2699926

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

.github/workflows/comment.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Comment
2+
3+
on:
4+
workflow_run:
5+
workflows: ['Validate JSON']
6+
types:
7+
- completed
8+
9+
permissions:
10+
contents: read
11+
pull-requests: write
12+
13+
jobs:
14+
comment:
15+
runs-on: ubuntu-latest
16+
if: ${{ github.event.workflow_run.conclusion == 'failure' }}
17+
steps:
18+
- name: Download Artifact
19+
uses: actions/download-artifact@v4
20+
with:
21+
name: artifact
22+
github-token: ${{ secrets.GITHUB_TOKEN }}
23+
run-id: ${{ github.event.workflow_run.id }}
24+
- name: Comment on PR
25+
uses: actions/github-script@v7
26+
with:
27+
github-token: ${{ secrets.GITHUB_TOKEN }}
28+
script: |
29+
let fs = require('fs');
30+
const issue_number = Number(fs.readFileSync('./pr_number'));
31+
const artifactString = fs.readFileSync('./artifact.txt').toString().trimEnd();
32+
await github.rest.issues.createComment({
33+
owner: context.repo.owner,
34+
repo: context.repo.repo,
35+
issue_number: issue_number,
36+
body: `${artifactString}`
37+
});

0 commit comments

Comments
 (0)