From 61c030b08fbf081cb265342bf693e0274f149a2a Mon Sep 17 00:00:00 2001 From: Jameel Kaisar <65322473+JameelKaisar@users.noreply.github.com> Date: Sun, 8 Oct 2023 17:39:10 +0000 Subject: [PATCH] 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. --- Library/Homebrew/dev-cmd/tap-new.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Library/Homebrew/dev-cmd/tap-new.rb b/Library/Homebrew/dev-cmd/tap-new.rb index ca1a0ccf34..aeddb9a3e7 100644 --- a/Library/Homebrew/dev-cmd/tap-new.rb +++ b/Library/Homebrew/dev-cmd/tap-new.rb @@ -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