2024-07-17 12:34:12 +00:00
name : Remind reviewers to also review the testing instructions and test coverage
2023-03-22 11:50:36 +00:00
on :
2023-04-28 07:55:10 +00:00
pull_request_target :
2023-03-22 11:50:36 +00:00
types : [ review_requested]
permissions : {}
jobs :
add-testing-instructions-review-comment :
runs-on : ubuntu-20.04
permissions :
pull-requests : write
steps :
2023-04-19 07:51:11 +00:00
- uses : actions/checkout@v3
- name : Setup Node.js
uses : actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c
- name : Install Octokit
2024-05-10 13:10:41 +00:00
run : npm --prefix .github/workflows/scripts install @octokit/action@~6.1.0
2023-04-19 07:51:11 +00:00
- name : Install Actions Core
2024-05-10 13:10:41 +00:00
run : npm --prefix .github/workflows/scripts install @actions/core@~1.10.1
2023-04-19 07:51:11 +00:00
2023-04-19 07:32:52 +00:00
- name : Check if user is a community contributor
id : is-community-contributor
run : node .github/workflows/scripts/is-community-contributor.js
env :
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
2023-03-22 11:50:36 +00:00
- name : Get the username of requested reviewers
2023-04-19 07:32:52 +00:00
if : steps.is-community-contributor.outputs.is-community == 'no'
2023-03-22 11:50:36 +00:00
id : get_reviewer_username
run : |
# Retrieves the username of all reviewers and stores them in a comma-separated list
reviewers=$(echo '${{ toJson(github.event.pull_request.requested_reviewers[*].login) }}' | jq -r 'map("@\(.)") | join(", ")')
echo "REVIEWERS=$reviewers" >> $GITHUB_ENV
- name : Get the name of requested teams
id : get_team_name
run : |
# Retrieves the name of all teams asked for review and stores them in a comma-separated list
teams=$(echo '${{ toJson(github.event.pull_request.requested_teams[*].slug) }}' | jq -r 'map("@woocommerce/\(.)") | join(", ")')
echo "TEAMS=$teams" >> $GITHUB_ENV
- name : Find the comment by github-actions[bot] asking for reviewing the testing instructions
uses : peter-evans/find-comment@034abe94d3191f9c89d870519735beae326f2bdb
id : find-comment
with :
issue-number : ${{ github.event.pull_request.number }}
comment-author : 'github-actions[bot]'
body-includes : please make sure to review the testing instructions
2024-07-17 12:34:12 +00:00
- name : Create or update PR comment asking for reviewers to review the testing instructions and test coverage
2023-03-22 11:50:36 +00:00
uses : peter-evans/create-or-update-comment@67dcc547d311b736a8e6c5c236542148a47adc3d
with :
comment-id : ${{ steps.find-comment.outputs.comment-id }}
issue-number : ${{ github.event.pull_request.number }}
body : |
Hi ${{ env.REVIEWERS }}, ${{ env.TEAMS }}
2024-07-17 12:34:12 +00:00
Apart from reviewing the code changes, please make sure to review the testing instructions and verify that relevant tests (E2E, Unit, Integration, etc.) have been added or updated as needed.
2023-03-22 11:50:36 +00:00
You can follow this guide to find out what good testing instructions should look like :
https://github.com/woocommerce/woocommerce/wiki/Writing-high-quality-testing-instructions
edit-mode : replace