diff --git a/.github/workflows/governance_pull_request_template.yml b/.github/workflows/governance_pull_request_template.yml new file mode 100644 index 00000000000..12fca286750 --- /dev/null +++ b/.github/workflows/governance_pull_request_template.yml @@ -0,0 +1,43 @@ +name: Governance Team Pull Request Template + +on: + pull_request: + types: + - opened + branches: + - master + +jobs: + # TODO: Change this name to "main". + template: + runs-on: ubuntu-latest + steps: + - name: Create GitHub App Token + uses: actions/create-github-app-token@v1 + id: app-token + with: + app-id: ${{ vars.PR_AUTOMATION_BOT_PUBLIC_APP_ID }} + private-key: ${{ secrets.PR_AUTOMATION_BOT_PUBLIC_PRIVATE_KEY }} + + - name: Is the author a member of nns-team? + uses: tspascoal/get-user-teams-membership@v2 + id: isAuthorInNnsTeam + with: + GITHUB_TOKEN: ${{ steps.app-token.outputs.token }} + username: ${{ github.actor }} + team: nns-team + + - name: Pre-populate pull request description. + if: ${{ steps.isAuthorInNnsTeam.isTeamMember == 'true' }} + uses: actions/github-script@v6 + with: + github-token: ${{ github.token }} + script: | + const pullRequestId = context.pullRequest.id; + const template = 'Your custom template here'; + await github.pulls.update({ + owner: context.repo.owner, + repo: context.repo.repo, + pull_number: pullRequestId, + body: template, + });