Skip to content

❌ Close a GitHub Pull Request as unmerged

Notifications You must be signed in to change notification settings

actions4gh/close-pr

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

255 Commits
 
 
 
 
 
 

Repository files navigation

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

About

❌ Close a GitHub Pull Request as unmerged

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 7