-
Notifications
You must be signed in to change notification settings - Fork 525
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes PR thank you msg. from potentially tagging the PR author twice (#…
- Loading branch information
1 parent
fa5fa25
commit fc2ac3b
Showing
1 changed file
with
10 additions
and
16 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,26 +18,20 @@ jobs: | |
uses: actions/[email protected] | ||
with: | ||
script: | | ||
const thankyouNote = 'Your efforts have helped advance digital healthcare and TeleICU systems. :rocket: Thank you for taking the time out to make CARE better. We hope you continue to innovate and contribute; your impact is immense! :raised_hands:' | ||
const thankyouNote = 'Your efforts have helped advance digital healthcare and TeleICU systems. :rocket: Thank you for taking the time out to make CARE better. We hope you continue to innovate and contribute; your impact is immense! :raised_hands:'; | ||
const options = { | ||
issue_number: context.issue.number, | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
} | ||
}; | ||
const result = await github.rest.issues.get({ | ||
issue_number: context.issue.number, | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
}) | ||
const { assignees, user } = result.data | ||
const { data : { assignees, user } } = await github.rest.issues.get(options); | ||
const assignees_tagged = assignees.map((user) => '@' + user.login).join(' ') | ||
const owner_tagged = '@' + user.login | ||
const taggedUsers = [...new Set( | ||
assignees.map(u => "@"+u.login).concat("@"+user.login) | ||
)].join(" ") | ||
if (assignees.length == 0) { | ||
await github.rest.issues.createComment({ ...options, body: `${owner_tagged} ${thankyouNote}` }) | ||
} else { | ||
await github.rest.issues.createComment({ ...options, body: `${assignees_tagged} ${owner_tagged} ${thankyouNote}` }) | ||
} | ||
await github.rest.issues.createComment({ | ||
...options, | ||
body: `${taggedUsers} ${thankyouNote}` | ||
}); |