Skip to content

Create pull request template #1

Create pull request template

Create pull request template #1

# 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
});