-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
37 lines (34 loc) · 1.11 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
name: Comment
on:
workflow_run:
workflows: ['Markdown Link Check', 'Markdown Lint Check', 'Markdown Terminology Lint Check']
types:
- completed
permissions:
contents: read
pull-requests: write
jobs:
comment:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'failure' }}
steps:
- name: Download Artifact
uses: actions/download-artifact@v4
with:
name: artifact
github-token: ${{ secrets.GITHUB_TOKEN }}
run-id: ${{ github.event.workflow_run.id }}
- name: Comment on PR
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
let fs = require('fs');
const issue_number = Number(fs.readFileSync('./pr_number'));
const artifactString = fs.readFileSync('./artifact.txt').toString().trimEnd();
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue_number,
body: `${artifactString}`
});