From f283b50e86ad8c202c6f31f0cae6e62959aa1d6d Mon Sep 17 00:00:00 2001 From: Florian Haas Date: Wed, 16 Aug 2023 12:27:24 +0200 Subject: [PATCH] build: Post pull request comments on build check failure Without this change, when a PR results in a build failure, the onus is on the PR submitter to find the failed build, and the corresponding build log. That is somewhat tedious and not particularly intuituive. Instead, use a separate GitHub Action that posts a comment back to the PR thread, containing a direct link to the failed build log. This should hopefully make it easier for PR submitters to find out what exactly their submitted change breaks. References: https://github.com/quipper/comment-failure-action/ https://github.com/quipper/comment-failure-action/pull/6 --- .github/workflows/build.yml | 2 +- .github/workflows/check.yml | 2 +- .github/workflows/comment.yml | 20 ++++++++++++++++++++ .github/workflows/deploy.yml | 2 +- 4 files changed, 23 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/comment.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d731f0ee6..33f66b1eb 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -36,7 +36,7 @@ jobs: - '3.9' - '3.10' -name: Build +name: build # We want to run this workflow on each push to a topic branch, and on # each pull request. Once we merge to main, we want to run the diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index cb0e8b891..46c8d0cf5 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -16,7 +16,7 @@ jobs: run: | tox -e check-prod -name: 'Check links' +name: check # We want to run this workflow every time we build the site. # In addition, we want to run it once a week on a schedule. diff --git a/.github/workflows/comment.yml b/.github/workflows/comment.yml new file mode 100644 index 000000000..189da07e5 --- /dev/null +++ b/.github/workflows/comment.yml @@ -0,0 +1,20 @@ +# Post a comment back on a PR thread, in case an associated workflow +# failed. Note that comment-failure-action is a no-op in case the +# workflow was not invoked in response to a PR. In other words, this +# action only creates comments for workflows configured with +# "on: pull_request". +--- +jobs: + comment-failure: + runs-on: ubuntu-latest + steps: + - uses: quipper/comment-failure-action@v0.1.1 + +name: comment + +'on': + workflow_run: + types: + - completed + workflows: + - build diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 37e759689..adc2d56ac 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -17,7 +17,7 @@ jobs: - name: Deploy to gh-pages run: tox -e deploy-github -name: Deploy +name: deploy 'on': push: