Skip to content

Commit

Permalink
Merge pull request #190657 from Homebrew/create-pull-request-1
Browse files Browse the repository at this point in the history
remove-disabled-packages: switch to `create-pull-request` action
  • Loading branch information
carlocab committed Sep 15, 2024
2 parents d8a1d73 + 690ca84 commit f956cb0
Showing 1 changed file with 25 additions and 13 deletions.
38 changes: 25 additions & 13 deletions .github/workflows/remove-disabled-packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ on:
# Once every day at midnight UTC
- cron: "0 0 * * *"

env:
RUN_URL: ${{github.event.repository.html_url}}/actions/runs/${{github.run_id}}

concurrency:
group: remove-disabled-packages
cancel-in-progress: true
Expand Down Expand Up @@ -71,20 +74,29 @@ jobs:
HOMEBREW_GPG_PASSPHRASE: ${{ secrets.BREWTESTBOT_GPG_SIGNING_SUBKEY_PASSPHRASE }}

- name: Create pull request
id: pr-create
if: fromJson(steps.remove_disabled.outputs.packages-removed)
working-directory: ${{ steps.set-up-homebrew.outputs.repository-path }}
uses: Homebrew/actions/create-pull-request@master
with:
token: ${{secrets.HOMEBREW_GITHUB_PUBLIC_REPO_TOKEN}}
base: master
head: ${{env.REMOVAL_BRANCH}}
title: Remove disabled packages
labels: CI-no-bottles
body: This pull request was created automatically by the [`remove-disabled-packages`](${{env.RUN_URL}}) workflow.

create-issue:
permissions:
issues: write # for `gh issue create`
needs: remove-disabled-packages
if: failure()
runs-on: ubuntu-latest
steps:
- name: Create issue on failure
env:
GH_TOKEN: ${{ secrets.HOMEBREW_GITHUB_PUBLIC_REPO_TOKEN }}
PR_BODY: >
This pull request was created automatically by the
[`remove-disabled-packages`](https://github.com/Homebrew/homebrew-core/blob/HEAD/.github/workflows/remove-disabled-packages.yml)
workflow.
GH_TOKEN: ${{secrets.GITHUB_TOKEN}}
run: |
gh pr create \
--base master \
--body "$PR_BODY" \
--head "$REMOVAL_BRANCH" \
--label CI-no-bottles \
--title 'Remove disabled packages' \
gh issue create \
--title 'Disabled package removal failed' \
--body "Run failed at $RUN_URL" \
--label 'bug,help wanted' \
--repo "$GITHUB_REPOSITORY"

0 comments on commit f956cb0

Please sign in to comment.