Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update greet.yml #104

Merged
merged 1 commit into from
Jun 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions .github/workflows/greet.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
name: Greet New PRs
name: Greet New PRs and Issues

on:
pull_request:
types: [opened]
issues:
types: [opened]

permissions:
issues: write
Expand All @@ -12,16 +14,19 @@ jobs:
greet:
runs-on: ubuntu-latest
steps:
- name: Greet the user
- name: Greet on PRs and Issues
uses: actions/github-script@v6
with:
script: |
const pr = context.payload.pull_request;
const commentBody = `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.`;
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: pr.number,
issue_number: number,
body: commentBody
});
Loading