Skip to content

Commit cc4441d

Browse files
committed
build(fpb-lint): linting errors as pr comments EbookFoundation#4416
1 parent 0bc6367 commit cc4441d

File tree

1 file changed

+27
-4
lines changed

1 file changed

+27
-4
lines changed

Diff for: .github/workflows/fpb-lint.yml

+27-4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@ name: free-programming-books-lint
22

33
on: [push, pull_request]
44

5+
env:
6+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7+
GITHUB_RUN_ID: ${{ github.run_id }}
8+
PR: ${{ github.event.pull_request.html_url }}
9+
510
jobs:
611
build:
712

@@ -14,7 +19,25 @@ jobs:
1419
with:
1520
node-version: '16.x'
1621
- run: npm install -g free-programming-books-lint
17-
- run: fpb-lint ./books/
18-
- run: fpb-lint ./casts/
19-
- run: fpb-lint ./courses/
20-
- run: fpb-lint ./more/
22+
- run: |
23+
fpb-lint ./books/ &>> output.log || cat output.log
24+
- run: |
25+
fpb-lint ./casts/ &>> output.log || cat output.log
26+
- run: |
27+
fpb-lint ./courses/ &>> output.log || cat output.log
28+
- run: |
29+
fpb-lint ./more/ &>> output.log || cat output.log
30+
31+
- name: Output job
32+
if: ${{ always() &&
33+
github.event_name == 'pull_request' }}
34+
run: |
35+
if [ -s output.log ]
36+
then
37+
gh pr review $PR -r -b "Linter failed, fix the errors:
38+
\`\`\`
39+
$(cat output.log)
40+
\`\`\`"
41+
else
42+
gh pr review $PR -a
43+
fi

0 commit comments

Comments
 (0)