Update auto-comment.yml #2344
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Auto Comment | ||
on: | ||
issues: | ||
types: | ||
- opened | ||
pull_request: | ||
types: | ||
- opened | ||
jobs: | ||
auto-comment: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Debug Token | ||
run: echo "Token: ${{ secrets.PAT_TOKEN }}" | ||
env: | ||
PAT_TOKEN: ${{ secrets.PAT_TOKEN }} | ||
- name: Comment on issue/PR | ||
uses: actions/github-script@v6 | ||
with: | ||
github-token: ${{ secrets.PAT_TOKEN }} | ||
script: | | ||
const commentBody = context.event_name === 'issues' ? | ||
`@${{ github.event.issue.user.login }} Please Star ⭐️ the repo to earn '**_hacktober-accepted_**' label for the event.\nMeanwhile, if you want to work on this issue, please raise a PR, and we will review and merge it.` : | ||
`@${{ github.event.pull_request.user.login }} Please Star ⭐️ the repo to earn '**_hacktober-accepted_**' label for the event.`; | ||
const issue_number = context.event_name === 'issues' ? context.payload.issue.number : context.payload.pull_request.number; | ||
await github.rest.issues.createComment({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
issue_number: issue_number, | ||
body: commentBody | ||
}); |