Create pull request template #1
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This workflow creates an universal and cofigurable template for all dapp pull requests | |
name: Apply PR Template | |
on: | |
pull_request: | |
types: | |
- opened | |
branches: main | |
jobs: | |
create_pr_template: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set PR Body | |
run: | | |
TEMPLATE=$(<.github/pull_request_template.md) | |
PR_BODY=$(echo "TEMPLATE" | sed -e 's/^/ /') | |
jq -n --arg body "$PR_BODY" '{body: $body}' > pr_body.json | |
- name: Apply PR Body | |
uses: actions/github-script@v6 | |
with: | |
github-token: ${{secrets.GITHUB_TOKEN}} | |
script: | | |
const fs = require('fs'); | |
const prBody = JSON.parse(fs.readFileSync('pr_body.json', 'utf8')); | |
github.pulls.update({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
pull_number: context.issue.number, | |
body: prBody.body | |
}); |