-
Notifications
You must be signed in to change notification settings - Fork 66
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
ci: added ping-for-attention command to notify the reviewers #239
Merged
Merged
Changes from 3 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
8617b4b
New workflow ping-for-attention.yml created
Priyansh61 48cd26f
Update help-command.yml
Priyansh61 c04c57f
Update ping-for-attention.yml
Priyansh61 be70e5f
Update help-command.yml
Priyansh61 ff0e594
Update and rename ping-for-attention.yml to please-take-a-look-comman…
Priyansh61 16bca37
Merge branch 'master' into pfa
KhudaDad414 ec48edc
Update help-command.yml
KhudaDad414 6acfd13
add to global replicator
KhudaDad414 c73b030
Merge branch 'master' into pfa
KhudaDad414 1c9bf53
Merge branch 'master' into pfa
KhudaDad414 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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 |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# This action is centrally managed in https://github.com/asyncapi/.github/ | ||
# Don't make changes to this file in this repo as they will be overwritten with changes made to the same file in above mentioned repo | ||
|
||
# It uses Github actions to listen for comments on issues and pull requests and | ||
# if the comment contains /ping-for-attention or /pfa it will add a comment pinging | ||
# the code-owners who have not yet reviewed the pull request | ||
|
||
name: ping-for-attention | ||
|
||
on: | ||
issue_comment: | ||
types: [created] | ||
|
||
jobs: | ||
ping-for-attention: | ||
if: > | ||
github.event.issue.pull_request && | ||
github.event.issue.state != 'closed' && | ||
github.actor != 'asyncapi-bot' && | ||
( | ||
contains(github.event.comment.body, '/ping-for-attention') || | ||
contains(github.event.comment.body, '/pfa') || | ||
contains(github.event.comment.body, '/ptal') || | ||
contains(github.event.comment.body, '/PTAL') | ||
) | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check for Ping for Attention Command | ||
uses: actions/github-script@v6 | ||
with: | ||
github-token: ${{ secrets.GH_TOKEN }} | ||
script: | | ||
const prDetailsUrl = context.payload.issue.pull_request.url; | ||
const { data: pull } = await github.request(prDetailsUrl); | ||
const reviewers = pull.requested_reviewers.map(reviewer => reviewer.login); | ||
|
||
const { data: reviews } = await github.rest.pulls.listReviews({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
pull_number: context.issue.number | ||
}); | ||
|
||
const reviewersWhoHaveReviewed = reviews.map(review => review.user.login); | ||
|
||
const reviewersWhoHaveNotReviewed = reviewers.filter(reviewer => !reviewersWhoHaveReviewed.includes(reviewer)); | ||
|
||
if (reviewersWhoHaveNotReviewed.length > 0) { | ||
const comment = reviewersWhoHaveNotReviewed.map(reviewer => `@${reviewer}`).join(' '); | ||
await github.rest.issues.createComment({ | ||
issue_number: context.issue.number, | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
body: `${comment} Please take a look at this PR. Thanks! :wave:` | ||
}); | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should just go with one way, and
ptal
is the best one as it is known short, just doptal
and longer version which probably is something likeplease take a look
(probably something to check with urban dictionary)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done