Skip to content

DS-1541 Improve Application Documentation #490

DS-1541 Improve Application Documentation

DS-1541 Improve Application Documentation #490

name: "Update Pull Request description with Template"
on:
pull_request:
types: [opened]
branches-ignore:
- 'dependabot/**'
permissions:
contents: read
pull-requests: write
jobs:
update-pull-request:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Get Branch Name
uses: mdecoleman/pr-branch-name@1.2.0
id: branch_name
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Get branch number
run: echo "BRANCH_NUMBER=$(echo ${{ steps.branch_name.outputs.branch }} | grep -Eo '[A-Za-z]{2,5}-[0-9]{1,5}')" >> $GITHUB_ENV
- name: Get branch designator
run: echo "BRANCH_DESIGNATOR=$(echo ${{ steps.branch_name.outputs.branch }} | sed 's|/.*||')" >> $GITHUB_ENV
- name: Get template name
run: echo "TEMPLATE_NAME=$(cat .github/PULL_REQUEST_TEMPLATE/${{ env.BRANCH_DESIGNATOR }}_pull_request_template.md > /dev/null 2>&1 && echo ${{ env.BRANCH_DESIGNATOR }}_pull_request_template.md || echo task_pull_request_template.md)" >> $GITHUB_ENV
- name: Render Pull Request template
id: template
uses: chuhlomin/render-template@v1.5
with:
template: .github/PULL_REQUEST_TEMPLATE/${{ env.TEMPLATE_NAME }}
vars: |
BRANCH_NUMBER: ${{ env.BRANCH_NUMBER }}
BRANCH_DESIGNATOR: ${{ env.BRANCH_DESIGNATOR }}
- uses: tzkhan/pr-update-action@v2
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
head-branch-regex: '${{ env.BRANCH_DESIGNATOR }}/.*'
body-template: ${{ steps.template.outputs.result }}
body-update-action: 'replace'