-
Notifications
You must be signed in to change notification settings - Fork 1
40 lines (38 loc) · 1.31 KB
/
comment-on-linter-error.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
name: Comment on the pull request
# read-write repo token
# access to secrets
on:
workflow_run:
workflows: ["Check lint failure"]
types:
- completed
jobs:
comment:
runs-on: ubuntu-latest
if: >
github.event.workflow_run.event == 'pull_request' &&
github.event.workflow_run.conclusion == 'failure'
steps:
- name: 'Download artifact'
uses: actions/download-artifact@v4
with:
name: pr-number
path: pr
run-id: ${{github.event.workflow_run.id }}
- name: Display structure of downloaded files
run: ls -R pr
- name: Catfile
run: cat pr/pr-number
- name: 'Comment on PR'
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
var fs = require('fs');
var issue_number = Number(fs.readFileSync('pr/pr-number'));
github.rest.issues.createComment({
issue_number: issue_number,
owner: context.repo.owner,
repo: context.repo.repo,
body: "Thanks for submitting this PR!\n\nUnfortunately, it has some linter errors, so we can't merge it yet. Can you please fix them?\n\nRunning yarn `lint:fix` in the root of the repository may fix them automatically."
})