Skip to content

Close GitHub Pull Request

Actions
❌ Close a GitHub Pull Request as unmerged
marketplace
Latest
Star (1)

Close GitHub Pull Request

❌ Close a GitHub Pull Request as unmerged

👨‍💻 Use the GitHub CLI
😱 You don't even need a GitHub Action to do it!

Usage

GitHub Actions GitHub

🚀 Here's what you're after:

name: Close with Lorem Ipsum comment
on:
  pull_request:
    types: labeled
jobs:
  test-action:
    if: github.event.label.name == 'lorem ipsum'
    permissions:
      pull-requests: write
    runs-on: ubuntu-latest
    steps:
      - run: gh pr close "$NUMBER" --comment "$COMMENT"
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          GH_REPO: ${{ github.repository }}
          NUMBER: ${{ github.event.number }}
          COMMENT: >
            Lorem ipsum is placeholder text commonly used in the graphic, print,
            and publishing industries for previewing layouts and visual mockups.

💡 The GitHub CLI is always provided on all GitHub runners. To install it on custom runners check out actions4gh/setup-gh.

gh pr close {<number> | <url> | <branch>} [flags]

gh issue comment options: (excerpt)

  • -c--comment <string>: Leave a closing comment

  • -d--delete-branch: Delete the local and remote branch after close

  • -R--repo <[HOST/]OWNER/REPO>: Select another repository using the [HOST/]OWNER/REPO format

📚 gh pr close | GitHub CLI

Close GitHub Pull Request is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.

About

❌ Close a GitHub Pull Request as unmerged
marketplace
Latest

Close GitHub Pull Request is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.