Skip to content

Latest commit

 

History

History
34 lines (27 loc) · 1.01 KB

File metadata and controls

34 lines (27 loc) · 1.01 KB

Commenting on an issue from a GitHub Action

Uses actions/github_script

Gets issue_number from the GitHub context, same with the owner and repo.

name: Comment on a new issue 

on:
  issues:
    types: opened

jobs:
  create-issue-comment:
    runs-on: ubuntu-latest
    steps:
      - name: Comment on issue
        id: create_comment
        uses: actions/github-script@v6
        with:
          github-token: ${{secrets.GITHUB_TOKEN}}
          script: |
            github.rest.issues.createComment({
              issue_number: context.issue.number,
              owner: context.repo.owner,
              repo: context.repo.repo,
              body: "👋 Hi there!"
            })

Result when a new issue is created:

Screen Shot 2022-11-04 at 12 43 33 PM