updated the version to 1.0.9 #1
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: Greetings | |
on: | |
pull_request: | |
types: [opened] | |
issues: | |
types: [opened] | |
permissions: | |
issues: write | |
pull-requests: write | |
jobs: | |
greet: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Greet on PRs and Issues | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
try { | |
const isPR = context.payload.pull_request !== undefined; | |
const number = isPR ? context.payload.pull_request.number : context.payload.issue.number; | |
const commentBody = isPR | |
? `Welcome, @${{ github.actor }}! Thanks for raising the issue!` | |
: `Great job, @${{ github.actor }}! Thanks for creating the pull request`; | |
await github.rest.issues.createComment({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
issue_number: number, | |
body: commentBody | |
}); | |
console.log('Comment successfully created.'); | |
} catch (error) { | |
console.error('Error creating comment:', error); | |
// Do not mark the step as failed; continue with the workflow. | |
} |