Add template and workflow to add review template to PRs (#19185)
* add review template and workflow * use sha instead of version for action * exclude template from check for private repo links * Apply suggestions from code review Co-authored-by: Emily Gould <4822039+emilyistoofunky@users.noreply.github.com> Co-authored-by: Emily Gould <4822039+emilyistoofunky@users.noreply.github.com>
This commit is contained in:
36
.github/workflows/add-review-template.yml
vendored
Normal file
36
.github/workflows/add-review-template.yml
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
name: Add review template
|
||||
|
||||
# **What it does**: When a specific label is added to a PR, adds the contents of .github/review-template.md as a comment in the PR
|
||||
# **Why we have it**: To help Docs Content team members ensure that their PR is ready for review
|
||||
# **Who does it impact**: docs-internal maintainers and contributors
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types:
|
||||
- labeled
|
||||
|
||||
jobs:
|
||||
comment-that-approved:
|
||||
name: Add review template
|
||||
runs-on: ubuntu-latest
|
||||
if: github.event.label.name == 'docs-content-ready-for-review' && github.repository == 'github/docs-internal'
|
||||
|
||||
steps:
|
||||
- name: check out repo content
|
||||
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f
|
||||
|
||||
# Jump through some hoops to work with a multi-line file
|
||||
- name: Store review template in variable
|
||||
run: |
|
||||
TEMPLATE=$(cat .github/workflows/review-template.md)
|
||||
echo "TEMPLATE<<EOF" >> $GITHUB_ENV
|
||||
echo "$TEMPLATE" >> $GITHUB_ENV
|
||||
echo "EOF" >> $GITHUB_ENV
|
||||
|
||||
- name: Comment on the PR
|
||||
run: |
|
||||
gh pr comment $PR --body "$TEMPLATE"
|
||||
env:
|
||||
GITHUB_TOKEN: ${{secrets.DOCUBOT_FR_PROJECT_BOARD_WORKFLOWS_REPO_ORG_READ_SCOPES}}
|
||||
PR: ${{ github.event.pull_request.html_url }}
|
||||
TEMPLATE: ${{ env.TEMPLATE }}
|
||||
Reference in New Issue
Block a user