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..23b4e43d 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 ([#349](https://github.com/MetaMask/github-tools/pull/349)) + ### 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))