Skip to content

Commit

Permalink
build: Post pull request comments on build check failure
Browse files Browse the repository at this point in the history
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/
quipper/comment-failure-action#6
  • Loading branch information
fghaas committed Aug 16, 2023
1 parent b006c18 commit b1a4f97
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
20 changes: 20 additions & 0 deletions .github/workflows/comment.yml
Original file line number Diff line number Diff line change
@@ -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 does creates a comments for workflows configured with
# "on: pull_request".
---
jobs:
comment-failure:
runs-on: ubuntu-latest
steps:
- uses: quipper/[email protected]

name: comment

'on':
workflow_run:
types:
- completed
workflows:
- build
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: Deploy to gh-pages
run: tox -e deploy-github

name: Deploy
name: deploy

'on':
push:
Expand Down

0 comments on commit b1a4f97

Please sign in to comment.