Adds concurrency limit to workflow run (#50034)
Co-authored-by: Jon Lane <jon.lane@automattic.com>
This commit is contained in:
parent
07a71106dc
commit
31c4ae8431
|
@ -1,66 +1,70 @@
|
||||||
name: Remind reviewers to also review the testing instructions and test coverage
|
name: Remind reviewers to also review the testing instructions and test coverage
|
||||||
on:
|
on:
|
||||||
pull_request_target:
|
pull_request_target:
|
||||||
types: [review_requested]
|
types: [review_requested]
|
||||||
|
|
||||||
permissions: {}
|
permissions: {}
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
add-testing-instructions-review-comment:
|
add-testing-instructions-review-comment:
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-20.04
|
||||||
permissions:
|
permissions:
|
||||||
pull-requests: write
|
pull-requests: write
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Setup Node.js
|
- name: Setup Node.js
|
||||||
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c
|
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c
|
||||||
|
|
||||||
- name: Install Octokit
|
- name: Install Octokit
|
||||||
run: npm --prefix .github/workflows/scripts install @octokit/action@~6.1.0
|
run: npm --prefix .github/workflows/scripts install @octokit/action@~6.1.0
|
||||||
|
|
||||||
- name: Install Actions Core
|
- name: Install Actions Core
|
||||||
run: npm --prefix .github/workflows/scripts install @actions/core@~1.10.1
|
run: npm --prefix .github/workflows/scripts install @actions/core@~1.10.1
|
||||||
|
|
||||||
- name: Check if user is a community contributor
|
- name: Check if user is a community contributor
|
||||||
id: is-community-contributor
|
id: is-community-contributor
|
||||||
run: node .github/workflows/scripts/is-community-contributor.js
|
run: node .github/workflows/scripts/is-community-contributor.js
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Get the username of requested reviewers
|
- name: Get the username of requested reviewers
|
||||||
if: steps.is-community-contributor.outputs.is-community == 'no'
|
if: steps.is-community-contributor.outputs.is-community == 'no'
|
||||||
id: get_reviewer_username
|
id: get_reviewer_username
|
||||||
run: |
|
run: |
|
||||||
# Retrieves the username of all reviewers and stores them in a comma-separated list
|
# 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(", ")')
|
reviewers=$(echo '${{ toJson(github.event.pull_request.requested_reviewers[*].login) }}' | jq -r 'map("@\(.)") | join(", ")')
|
||||||
echo "REVIEWERS=$reviewers" >> $GITHUB_ENV
|
echo "REVIEWERS=$reviewers" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Get the name of requested teams
|
- name: Get the name of requested teams
|
||||||
id: get_team_name
|
id: get_team_name
|
||||||
run: |
|
run: |
|
||||||
# Retrieves the name of all teams asked for review and stores them in a comma-separated list
|
# 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(", ")')
|
teams=$(echo '${{ toJson(github.event.pull_request.requested_teams[*].slug) }}' | jq -r 'map("@woocommerce/\(.)") | join(", ")')
|
||||||
echo "TEAMS=$teams" >> $GITHUB_ENV
|
echo "TEAMS=$teams" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Find the comment by github-actions[bot] asking for reviewing the testing instructions
|
- name: Find the comment by github-actions[bot] asking for reviewing the testing instructions
|
||||||
uses: peter-evans/find-comment@034abe94d3191f9c89d870519735beae326f2bdb
|
uses: peter-evans/find-comment@034abe94d3191f9c89d870519735beae326f2bdb
|
||||||
id: find-comment
|
id: find-comment
|
||||||
with:
|
with:
|
||||||
issue-number: ${{ github.event.pull_request.number }}
|
issue-number: ${{ github.event.pull_request.number }}
|
||||||
comment-author: 'github-actions[bot]'
|
comment-author: 'github-actions[bot]'
|
||||||
body-includes: please make sure to review the testing instructions
|
body-includes: please make sure to review the testing instructions
|
||||||
|
|
||||||
- name: Create or update PR comment asking for reviewers to review the testing instructions and test coverage
|
- name: Create or update PR comment asking for reviewers to review the testing instructions and test coverage
|
||||||
uses: peter-evans/create-or-update-comment@67dcc547d311b736a8e6c5c236542148a47adc3d
|
uses: peter-evans/create-or-update-comment@67dcc547d311b736a8e6c5c236542148a47adc3d
|
||||||
with:
|
with:
|
||||||
comment-id: ${{ steps.find-comment.outputs.comment-id }}
|
comment-id: ${{ steps.find-comment.outputs.comment-id }}
|
||||||
issue-number: ${{ github.event.pull_request.number }}
|
issue-number: ${{ github.event.pull_request.number }}
|
||||||
body: |
|
body: |
|
||||||
Hi ${{ env.REVIEWERS }}, ${{ env.TEAMS }}
|
Hi ${{ env.REVIEWERS }}, ${{ env.TEAMS }}
|
||||||
|
|
||||||
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.
|
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.
|
||||||
|
|
||||||
You can follow this guide to find out what good testing instructions should look like:
|
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
|
https://github.com/woocommerce/woocommerce/wiki/Writing-high-quality-testing-instructions
|
||||||
edit-mode: replace
|
edit-mode: replace
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
Significance: patch
|
||||||
|
Type: dev
|
||||||
|
|
||||||
|
Updated the workflow prompting for testing instructions to only run once (preventing double comments)
|
Loading…
Reference in New Issue