Repository navigation
feat(publish-preview-oidc): comment on the pull request when publishing fails - #349
Merged
Merged
Conversation
Add a `comment-on-failure` job to `publish-preview-oidc` that posts a link to the workflow run on the pull request when the build or publish job fails. Previously, a failure before the final comment step left the pull request with no comment, so people had to check the Actions tab to find out what happened.
Link the changelog entry for the `comment-on-failure` job to its pull request.
Mrtenz
commented
Nov 23, 2026
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Post failure comment | ||
| run: gh pr comment "${PR_NUMBER}" --body "Failed to publish preview builds. [See the workflow run for details](https://github.com/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}/attempts/${GITHUB_RUN_ATTEMPT})." |
Member
Author
There was a problem hiding this comment.
Example here: Mrtenz/monorepo-test#1 (comment).
Mrtenz
marked this pull request as ready for review
November 23, 2026 11:33
GuillaumeRx
approved these changes
Nov 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
publish-preview-oidcworkflow only comments on the pull request from the last step of the publish job. When something fails earlier, such as an unknown package name, a build error, a tarball that fails validation, or a polyrepo publish failure, the pull request gets no comment, and whoever ran the workflow has to go and look at the Actions tab.This adds a
comment-on-failurejob that depends on thebuildandpublish-previewjobs. It runs when either of them fails and a pull request number is set, and posts a comment with a link to the workflow run. A step at the end of the publish job wouldn't catch build failures, because the publish job is skipped when the build job fails.The job has only
pull-requests: write, has no environment gate, and runs nothing from the pull request. The comment text is fixed, so nothing from the build job ends up in it. Cancelled runs and fork pull requests (where the publish job is skipped) don't get a comment. Partial monorepo failures are already listed in the normal comment.Note
Low Risk
CI-only change that posts a static failure comment when a PR number is set; no application or publish logic is modified.
Overview
Adds failure feedback to the publish-preview-oidc reusable workflow so PR authors get a comment when preview publishing does not complete successfully.
A new
comment-on-failurejob runs afterbuildandpublish-previewwhen either job fails and a pull request number was provided. It posts a fixed message with a link to the workflow run, using onlypull-requests: writeand no environment gate—covering cases wherebuildfails andpublish-previewis skipped, which the existing success comment at the end of the publish job never handled.The unreleased changelog documents the behavior change.
Reviewed by Cursor Bugbot for commit 3067ba9. Bugbot is set up for automated code reviews on this repo. Configure here.