[FEATURE] Add my app #6
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: Greet New PRs and Issues | |
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 | |
? `Hey there! 👋 Thanks for taking the time to send in this pull request. We are happy to have your contribution! If you have any questions or need any help, feel free to ask.` | |
: `Hello! 👋 Thanks for opening this issue. We appreciate your feedback and will look into it as soon as possible. Feel free to add more details if necessary.`; | |
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. | |
} |