Skip to content

Commit 22b6e51

Browse files
authored
Merge pull request #26 from physiopy/demo-PR
Testing PR config
2 parents c79ab24 + c0ae6a6 commit 22b6e51

File tree

4 files changed

+46
-14
lines changed

4 files changed

+46
-14
lines changed
Lines changed: 31 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,52 @@
1-
name: Main Reviewer Checklist
1+
name: Reviewer Checklist
22

33
on:
44
pull_request:
5-
types: [assigned]
5+
types: [review_requested]
66

77
jobs:
88
checklist:
99
runs-on: ubuntu-latest
10-
1110
steps:
12-
# Step 1: Check out the repository
1311
- name: Checkout repository
1412
uses: actions/checkout@v3
1513

16-
# Step 2: Extract the main reviewer (assignee) and PR details
17-
- name: Extract PR details
14+
- name: Extract PR reviewer info
1815
id: pr_details
1916
run: |
20-
echo "ASSIGNEE=$(jq -r '.assignee.login' < $GITHUB_EVENT_PATH)" >> $GITHUB_ENV
17+
REVIEWERS=$(jq -r '.pull_request.requested_reviewers[].login' < $GITHUB_EVENT_PATH)
18+
NEW_REVIEWER=$(jq -r '.requested_reviewer.login' < $GITHUB_EVENT_PATH)
19+
ACTOR=$(jq -r '.sender.login' < $GITHUB_EVENT_PATH)
20+
echo "REVIEWERS=$REVIEWERS" >> $GITHUB_ENV
21+
echo "NEW_REVIEWER=$NEW_REVIEWER" >> $GITHUB_ENV
22+
echo "ACTOR=$ACTOR" >> $GITHUB_ENV
23+
24+
- name: Determine checklist type
25+
id: checklist_type
26+
run: |
27+
# Only act if the user requested themselves
28+
if [ "$ACTOR" != "$NEW_REVIEWER" ]; then
29+
echo "SKIP=true" >> $GITHUB_ENV
30+
exit 0
31+
fi
32+
COUNT=$(echo "$REVIEWERS" | grep -c .)
33+
if [ "$COUNT" -eq "1" ]; then
34+
echo "TEMPLATE=main_rev_checklist.md" >> $GITHUB_ENV
35+
echo "SKIP=false" >> $GITHUB_ENV
36+
else
37+
echo "TEMPLATE=rev_checklist.md" >> $GITHUB_ENV
38+
echo "SKIP=false" >> $GITHUB_ENV
39+
fi
2140
22-
# Step 3: Replace the placeholder in the checklist template
23-
- name: Replace reviewer name in checklist template
41+
- name: Prepare checklist
42+
if: env.SKIP == 'false'
2443
run: |
25-
ASSIGNEE=${{ env.ASSIGNEE }}
26-
sed "s/__MAINREV__/$ASSIGNEE/g" .github/workflows/main_rev_checklist.md > filled_checklist.md
44+
sed "s/__REV__/${{ env.NEW_REVIEWER }}/g" .github/workflows/${{ env.TEMPLATE }} > filled_checklist.md
2745
28-
# Step 4: Post the filled checklist as a comment
2946
- name: Post checklist as a comment
47+
if: env.SKIP == 'false'
3048
uses: peter-evans/create-or-update-comment@v3
3149
with:
3250
token: ${{ secrets.GITHUB_TOKEN }}
33-
issue-number: ${{ github.event.pull_request.number }}
3451
body-path: filled_checklist.md
52+
issue-number: ${{ github.event.pull_request.number }}

.github/workflows/main_rev_checklist.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Hello @__MAINREV__!
1+
Hello @__REV__!
22

33
You've been assigned to this PR, which means that you've been nominated Main Reviewer! Lucky you!
44

.github/workflows/rev_checklist.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
Hello @__REV__!
2+
3+
You've been assigned to this PR, which means that you've been nominated as reviewer! You are a supporting reviewer, not the main reviewer - the main reviewer has more responsibilities than you (lucky them) but your review is still important.
4+
5+
If you have any doubt, check [this section on reviewing](https://phys2bids.readthedocs.io/en/latest/contributorfile.html#reviewing)
6+
7+
Checklist
8+
- [ ] one
9+
- [ ] two
10+
- [ ] three
11+
12+
Thank you!

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ This workflow automatically assigns labels to a PR if the PR edits a specific fi
3333
### 4 - welcome bot app, defined in [config.yml](https://github.com/physiopy/physiopy-test-workflows/blob/master/.github/config.yml)
3434
This bot automatically posts welcome and thank you messages when a contributor posts their first issue, first PR, and merges first PR. This is a nice way to welcome and thank new contributors, but also acts as an opportunity to direct them towards the relevant contributor guidelines, as needed.
3535

36+
### 5 - main reviewer checklist (desc to come)
37+
3638
Example:
3739

3840
![image](https://github.com/user-attachments/assets/b5fa9565-851b-4c0a-8b97-e9e414276b7d)

0 commit comments

Comments
 (0)