workflows/pkg-installer: create an issue when publish fails

This uses the `Homebrew/actions/create-or-update-issue` action added in
Homebrew/actions#588 to create an issue when the publish fails for a
release. It also automatically updates the issue on repeated failures,
and closes the issue when the latest workflow run succeeds.
This commit is contained in:
Ruoyu Zhong 2024-09-24 11:14:44 +08:00
parent bd3c7f8053
commit 2865080a8f
No known key found for this signature in database

View File

@ -213,3 +213,29 @@ jobs:
run: gh release upload --repo Homebrew/brew
"${GITHUB_REF//refs\/tags\//}"
"${{ needs.build.outputs.installer_path }}"
issue:
needs: [build, test, upload]
if: always() && github.event_name == 'release'
runs-on: ubuntu-latest
env:
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
permissions:
# To create or update issues
issues: write
steps:
- name: Open, update, or close pkg installer issue
uses: Homebrew/actions/create-or-update-issue@master
with:
title: Failed to publish pkg installer
body: >
The pkg installer workflow [failed](${{ env.RUN_URL }}) for release
${{ github.ref_name }}. No pkg installer was uploaded to the GitHub
release.
labels: bug,release blocker
update-existing: ${{ contains(needs.*.result, 'failure') }}
close-existing: ${{ needs.upload.result == 'success' }}
close-from-author: github-actions[bot]
close-comment: >
The pkg installer workflow [succeeded](${{ env.RUN_URL }}) for
release ${{ github.ref_name }}. Closing this issue.