π¬ Create a new comment on a GitHub Issue
π¨βπ» Use the GitHub CLI
π± You don't even need a GitHub Action to do it!
π Here's what you're after:
name: Lorem Ipsum comment
on:
issues:
types: labeled
jobs:
lorem-ipsum-comment:
if: github.event.label.name == 'lorem ipsum'
permissions:
issues: write
runs-on: ubuntu-latest
steps:
- run: gh issue comment "$NUMBER" --body "$BODY"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
NUMBER: ${{ github.event.issue.number }}
BODY: >
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 issue comment {<number> | <url>} [flags]
gh issue comment
options: (excerpt)
-
-b
,Β--body <text>
: The comment body text -
-F
,Β--body-file <file>
: Read body text from file (use "-" to read from standard input) -
--edit-last
: Edit the last comment of the same author -
-R
,Β--repo <[HOST/]OWNER/REPO>
: Select another repository using the[HOST/]OWNER/REPO
format