Skip to content

Commit

Permalink
Uses Jinja instead of sed to get more control on the variables
Browse files Browse the repository at this point in the history
  • Loading branch information
dpshelio committed Nov 3, 2022
1 parent 12c7a8a commit 144090e
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions .github/workflows/update-issue.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
name: Update issue
# Note that syntax to refer to this issue is: {{ this_issue }} and for a
# previous one: {{ (this_issue | int ) - 1 }}
on:
issues:
types:
Expand All @@ -11,10 +13,16 @@ jobs:
permissions:
issues: write
steps:
- uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install dependencies
run: |
pip install jinja-cli
- name: basic Shell
run: |
gh issue view ${{ github.event.issue.html_url }} --json body -t '{{.body}}' >> text_body
sed -i -e "s/{{this_issue}}/${{ github.event.issue.number }}/g" text_body
gh issue edit ${{ github.event.issue.html_url }} --body-file text_body
jinja -D "this_issue" "${{ github.event.issue.number }}" -o text_body_out text_body
gh issue edit ${{ github.event.issue.html_url }} --body-file text_body_out
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 144090e

Please sign in to comment.