From a6e2e798992c0b60da3c491fee6f0498a108ff1d Mon Sep 17 00:00:00 2001 From: Maarten Zuidhoorn Date: Mon, 23 Nov 2026 12:27:58 +0100 Subject: [PATCH 1/2] Comment on the pull request when the preview workflow fails 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. --- .github/workflows/publish-preview-oidc.yml | 17 +++++++++++++++++ CHANGELOG.md | 4 ++++ 2 files changed, 21 insertions(+) diff --git a/.github/workflows/publish-preview-oidc.yml b/.github/workflows/publish-preview-oidc.yml index 7362427b..120e15b5 100644 --- a/.github/workflows/publish-preview-oidc.yml +++ b/.github/workflows/publish-preview-oidc.yml @@ -267,3 +267,20 @@ jobs: GH_REPO: ${{ github.repository }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} PR_NUMBER: ${{ inputs.pull-request }} + + comment-on-failure: + name: Comment on failure + needs: + - build + - publish-preview + if: ${{ failure() && inputs.pull-request }} + permissions: + pull-requests: write + 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})." + env: + GH_REPO: ${{ github.repository }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + PR_NUMBER: ${{ inputs.pull-request }} diff --git a/CHANGELOG.md b/CHANGELOG.md index e6ad82eb..9aa84d90 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Added + +- Comment on the pull request when the `publish-preview-oidc` workflow fails + ### Changed - Publish tarballs packed in the build job in the `publish-preview-oidc` workflow, instead of the workspace ([#348](https://github.com/MetaMask/github-tools/pull/348)) From 3067ba91a984ec0714f57cbf991a38477c6f0e8a Mon Sep 17 00:00:00 2001 From: Maarten Zuidhoorn Date: Mon, 23 Nov 2026 12:30:50 +0100 Subject: [PATCH 2/2] Add the PR number to the changelog Link the changelog entry for the `comment-on-failure` job to its pull request. --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9aa84d90..23b4e43d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added -- Comment on the pull request when the `publish-preview-oidc` workflow fails +- Comment on the pull request when the `publish-preview-oidc` workflow fails ([#349](https://github.com/MetaMask/github-tools/pull/349)) ### Changed