Skip to content

Test Jinja Generation #211

Test Jinja Generation

Test Jinja Generation #211

Workflow file for this run

name: Test updating description
on:
workflow_dispatch:
jobs:
desc:
name: Update desc
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- name: PR Description Notifier
env:
GH_TOKEN: ${{ github.token }}
PR_BODY_FILE_LOCATION: ./body.txt
LATEST_PRERELEASE_SECTION_REGEX: "^:rocket: .* :rocket:$"
LATEST_PRERELEASE_SECTION_ESCAPED: ":rocket: The latest prerelease `x/y` is \\[here\\]\\(http://example.org\\) :rocket:"
run: |
gh pr view 22 --repo ${{ github.repository }} --json body --jq .body > ${{ env.PR_BODY_FILE_LOCATION }}
if grep -q '${{ env.LATEST_PRERELEASE_SECTION_REGEX }}' ${{ env.PR_BODY_FILE_LOCATION }}; then # there is an existing prerelease section
# Replace the existing prerelease section
sed -i 's|${{ env.LATEST_PRERELEASE_SECTION_REGEX }}|${{ env.LATEST_PRERELEASE_SECTION_ESCAPED }}|g' ${{ env.PR_BODY_FILE_LOCATION }}
else # a new section is added, with a delimiting section
sed -i '$a\'"
---
${{ env.LATEST_PRERELEASE_SECTION_ESCAPED }}" ${{ env.PR_BODY_FILE_LOCATION }}
fi
gh pr edit 22 --repo ${{ github.repository }} --body-file ${{ env.PR_BODY_FILE_LOCATION }}