From e9f7dff3be87e640a72f97bd4eec1be79ec2b43a Mon Sep 17 00:00:00 2001 From: Seth Falco Date: Tue, 28 Sep 2021 10:11:37 +0200 Subject: [PATCH] workflow: post build result as comment --- .editorconfig | 5 +++- .github/workflows/fpb-lint.yml | 42 ++++++++++++++++++++++++++-------- .travis.yml | 17 -------------- 3 files changed, 36 insertions(+), 28 deletions(-) delete mode 100644 .travis.yml diff --git a/.editorconfig b/.editorconfig index e9a9bff8..3bd93b7b 100644 --- a/.editorconfig +++ b/.editorconfig @@ -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 diff --git a/.github/workflows/fpb-lint.yml b/.github/workflows/fpb-lint.yml index ae20ca1e..beeb7d75 100644 --- a/.github/workflows/fpb-lint.yml +++ b/.github/workflows/fpb-lint.yml @@ -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 }} diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index aa86bdd9..00000000 --- a/.travis.yml +++ /dev/null @@ -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/