Skip to content

Update auto-comment.yml #2344

Update auto-comment.yml

Update auto-comment.yml #2344

Workflow file for this run

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 }}"

Check failure on line 16 in .github/workflows/auto-comment.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/auto-comment.yml

Invalid workflow file

You have an error in your yaml syntax on line 16
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
});