💬 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