Merge pull request #19496 from ZehMatt/backtrace-commit

Remove code tag for commit hash in issues for backtrace reports
This commit is contained in:
Matthias Moninger 2023-02-28 17:56:24 +02:00 committed by GitHub
commit 3b86a27137
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 26 additions and 0 deletions

View File

@ -0,0 +1,26 @@
name: 'Backtrace issue commit correction'
on:
issues:
types:
- opened
jobs:
backtrace_commit_correction:
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ISSUE: ${{ github.event.issue.html_url }}
if: |
contains(github.event.issue.labels.*.name, 'backtrace.io')
steps:
- name: Modify issue contents
env:
BODY: ${{ github.event.issue.body }}
id: fix
run: |
changed_body=$(echo "$BODY" | sed '/<strong>commit<\/strong>/,/<\/li>/ s/<code>\([0-9a-f]\{7,\}\)<\/code>/\1/')
if [[ "$changed_body" == "$BODY" ]]; then
echo "Unable to match the Backtrace report format."
exit 1
fi
echo "$changed_body" >> body.txt
gh issue edit $ISSUE --body-file body.txt