Skip to content
Merged
Show file tree
Hide file tree
Changes from 11 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
43 changes: 30 additions & 13 deletions .github/workflows/main-reviewer.yml
Original file line number Diff line number Diff line change
@@ -1,34 +1,51 @@
name: Main Reviewer Checklist
name: Reviewer Checklist

on:
pull_request:
types: [assigned]
types: [review_requested]

jobs:
checklist:
runs-on: ubuntu-latest

steps:
# Step 1: Check out the repository
- name: Checkout repository
uses: actions/checkout@v3

# Step 2: Extract the main reviewer (assignee) and PR details
- name: Extract PR details
- name: Extract PR reviewer info
id: pr_details
run: |
echo "ASSIGNEE=$(jq -r '.assignee.login' < $GITHUB_EVENT_PATH)" >> $GITHUB_ENV
REVIEWERS=$(jq -r '.pull_request.requested_reviewers[].login' < $GITHUB_EVENT_PATH)
NEW_REVIEWER=$(jq -r '.requested_reviewer.login' < $GITHUB_EVENT_PATH)
ACTOR=$(jq -r '.sender.login' < $GITHUB_EVENT_PATH)
echo "REVIEWERS=$REVIEWERS" >> $GITHUB_ENV
echo "NEW_REVIEWER=$NEW_REVIEWER" >> $GITHUB_ENV
echo "ACTOR=$ACTOR" >> $GITHUB_ENV
- name: Determine checklist type
id: checklist_type
run: |
# Only act if the user requested themselves
if [ "$ACTOR" != "$NEW_REVIEWER" ]; then
echo "SKIP=true" >> $GITHUB_ENV
exit 0
fi
COUNT=$(echo "$REVIEWERS" | wc -w)
if [ "$COUNT" -eq "1" ]; then
echo "TEMPLATE=main_rev_checklist.md" >> $GITHUB_ENV
echo "SKIP=false" >> $GITHUB_ENV
else
echo "TEMPLATE=rev_checklist.md" >> $GITHUB_ENV
echo "SKIP=false" >> $GITHUB_ENV
fi
# Step 3: Replace the placeholder in the checklist template
- name: Replace reviewer name in checklist template
- name: Prepare checklist
if: env.SKIP == 'false'
run: |
ASSIGNEE=${{ env.ASSIGNEE }}
sed "s/__MAINREV__/$ASSIGNEE/g" .github/workflows/main_rev_checklist.md > filled_checklist.md
sed "s/__REV__/${{ env.NEW_REVIEWER }}/g" .github/workflows/${{ env.TEMPLATE }} > filled_checklist.md
# Step 4: Post the filled checklist as a comment
- name: Post checklist as a comment
if: env.SKIP == 'false'
uses: peter-evans/create-or-update-comment@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.pull_request.number }}
body-path: filled_checklist.md
2 changes: 1 addition & 1 deletion .github/workflows/main_rev_checklist.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Hello @__MAINREV__!
Hello @__REV__!

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

Expand Down
12 changes: 12 additions & 0 deletions .github/workflows/rev_checklist.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Hello @__REV__!

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.

If you have any doubt, check [this section on reviewing](https://phys2bids.readthedocs.io/en/latest/contributorfile.html#reviewing)

Checklist
- [ ] one
- [ ] two
- [ ] three

Thank you!
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ This workflow automatically assigns labels to a PR if the PR edits a specific fi
### 4 - welcome bot app, defined in [config.yml](https://github.com/physiopy/physiopy-test-workflows/blob/master/.github/config.yml)
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.

### 5 - main reviewer checklist (desc to come)

Example:

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