workflow: post build result as comment

This commit is contained in:
Seth Falco
2021-09-28 10:11:37 +02:00
parent 433bdd4936
commit e9f7dff3be
3 changed files with 36 additions and 28 deletions

View File

@ -9,5 +9,8 @@ charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[*.md]
[*.{markdown,md}]
trim_trailing_whitespace = false
[*.{yaml,yml}]
indent_size = 2

View File

@ -1,20 +1,42 @@
name: free-programming-books-lint
on: [push, pull_request]
on:
push:
pull_request:
jobs:
build:
permissions:
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: '14.x'
- run: npm install -g free-programming-books-lint
- run: fpb-lint ./books/
- run: fpb-lint ./casts/
- run: fpb-lint ./courses/
- run: fpb-lint ./more/
- run: |
git clone https://github.com/SethFalco/free-programming-books-lint.git
cd free-programming-books-lint
git checkout origin/multiple-dirs
npm i
npm i -g .
- run: fpb-lint books casts courses more
if: github.event_name == 'push'
- run: |
fpb-lint books casts courses more 2>&1 | tee output.log
result_code=${PIPESTATUS[0]}
if [ $result_code != 0 ]
then
gh pr review $PR --body "The build failed with the following output:
\`\`\`
$(cat output.log)
\`\`\`" --request-changes
else
gh pr review $PR --approve
fi
exit $result_code
if: github.event_name == 'pull_request'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR: ${{ github.event.pull_request.html_url }}

View File

@ -1,17 +0,0 @@
language: shell
dist: xenial
os: linux
jobs:
include:
-
language: node_js
node_js:
- 14
before_script:
- npm install -g free-programming-books-lint
script:
- fpb-lint ./books/
- fpb-lint ./casts/
- fpb-lint ./courses/
- fpb-lint ./more/