β Close a GitHub Pull Request as unmerged
π¨βπ» Use the GitHub CLI
π± You don't even need a GitHub Action to do it!
π 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/REPOformat
