Skip to content

Commit db35528

Browse files
authored
ci: update of files from global .github repo (#1048)
1 parent b7bb62b commit db35528

File tree

2 files changed

+55
-0
lines changed

2 files changed

+55
-0
lines changed

.github/workflows/help-command.yml

+1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ jobs:
3131
3232
At the moment the following comments are supported in pull requests:
3333

34+
- \`/please-take-a-look` or \`/ptal\` - This comment will add a comment to the PR asking for attention from the reviewrs who have not reviewed the PR yet.
3435
- \`/ready-to-merge\` or \`/rtm\` - This comment will trigger automerge of PR in case all required checks are green, approvals in place and do-not-merge label is not added
3536
- \`/do-not-merge\` or \`/dnm\` - This comment will block automerging even if all conditions are met and ready-to-merge label is added
3637
- \`/autoupdate\` or \`/au\` - This comment will add \`autoupdate\` label to the PR and keeps your PR up-to-date to the target branch's future changes. Unless there is a merge conflict or it is a draft PR.`
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# This action is centrally managed in https://github.com/asyncapi/.github/
2+
# 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
3+
4+
# It uses Github actions to listen for comments on issues and pull requests and
5+
# if the comment contains /ping-for-attention or /pfa it will add a comment pinging
6+
# the code-owners who have not yet reviewed the pull request
7+
8+
name: Please take a Look
9+
10+
on:
11+
issue_comment:
12+
types: [created]
13+
14+
jobs:
15+
ping-for-attention:
16+
if: >
17+
github.event.issue.pull_request &&
18+
github.event.issue.state != 'closed' &&
19+
github.actor != 'asyncapi-bot' &&
20+
(
21+
contains(github.event.comment.body, '/please-take-a-look') ||
22+
contains(github.event.comment.body, '/ptal') ||
23+
contains(github.event.comment.body, '/PTAL')
24+
)
25+
runs-on: ubuntu-latest
26+
steps:
27+
- name: Check for Please Take a Look Command
28+
uses: actions/github-script@v6
29+
with:
30+
github-token: ${{ secrets.GH_TOKEN }}
31+
script: |
32+
const prDetailsUrl = context.payload.issue.pull_request.url;
33+
const { data: pull } = await github.request(prDetailsUrl);
34+
const reviewers = pull.requested_reviewers.map(reviewer => reviewer.login);
35+
36+
const { data: reviews } = await github.rest.pulls.listReviews({
37+
owner: context.repo.owner,
38+
repo: context.repo.repo,
39+
pull_number: context.issue.number
40+
});
41+
42+
const reviewersWhoHaveReviewed = reviews.map(review => review.user.login);
43+
44+
const reviewersWhoHaveNotReviewed = reviewers.filter(reviewer => !reviewersWhoHaveReviewed.includes(reviewer));
45+
46+
if (reviewersWhoHaveNotReviewed.length > 0) {
47+
const comment = reviewersWhoHaveNotReviewed.map(reviewer => `@${reviewer}`).join(' ');
48+
await github.rest.issues.createComment({
49+
issue_number: context.issue.number,
50+
owner: context.repo.owner,
51+
repo: context.repo.repo,
52+
body: `${comment} Please take a look at this PR. Thanks! :wave:`
53+
});
54+
}

0 commit comments

Comments
 (0)