Add close pr to actions publish

This commit enhances the publish actions script by
including a step to close the pull request after
committing the changes. The existing script deletes
the branch after pushing the commits, but lacks
the functionality to close the associated PR.
This commit is contained in:
Jameel Kaisar 2023-10-08 17:39:10 +00:00
parent 8f7e06ab6f
commit 61c030b08f

View File

@ -112,6 +112,9 @@ module Homebrew
pr-pull:
if: contains(github.event.pull_request.labels.*.name, '#{label}')
runs-on: ubuntu-22.04
permissions:
contents: write
pull-requests: write
steps:
- name: Set up Homebrew
uses: Homebrew/actions/setup-homebrew@master
@ -138,6 +141,14 @@ module Homebrew
env:
BRANCH: ${{ github.event.pull_request.head.ref }}
run: git push --delete origin $BRANCH
- name: Close pr
if: github.event.pull_request.head.repo.fork == false
env:
GITHUB_TOKEN: ${{ github.token }}
PULL_REQUEST: ${{ github.event.pull_request.number }}
REPO: ${{ github.repository }}
run: gh pr close $PULL_REQUEST --repo $REPO
YAML
(tap.path/".github/workflows").mkpath