From fec5314da44fd9f441ac9459cda6b14cb0fda2f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=CE=B6eh=20Matt?= <5415177+ZehMatt@users.noreply.github.com> Date: Sat, 25 Feb 2023 16:47:27 +0200 Subject: [PATCH 1/2] Remove code tag for commit hash in issues for backtrace reports --- .github/workflows/backtrace-commit-fix.yml | 26 ++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 .github/workflows/backtrace-commit-fix.yml diff --git a/.github/workflows/backtrace-commit-fix.yml b/.github/workflows/backtrace-commit-fix.yml new file mode 100644 index 0000000000..c51f986767 --- /dev/null +++ b/.github/workflows/backtrace-commit-fix.yml @@ -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 '/commit<\/strong>/,/<\/li>/ s/\(\)\(.*\)\(<\/code>\)/\2/g') + 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 \ No newline at end of file From f062c64876001216cd5d1030aaffaa35bb6fb1f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=CE=B6eh=20Matt?= <5415177+ZehMatt@users.noreply.github.com> Date: Tue, 28 Feb 2023 15:50:16 +0200 Subject: [PATCH 2/2] Apply review suggestions --- .github/workflows/backtrace-commit-fix.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/backtrace-commit-fix.yml b/.github/workflows/backtrace-commit-fix.yml index c51f986767..ee1923e885 100644 --- a/.github/workflows/backtrace-commit-fix.yml +++ b/.github/workflows/backtrace-commit-fix.yml @@ -17,10 +17,10 @@ jobs: BODY: ${{ github.event.issue.body }} id: fix run: | - changed_body=$(echo "$BODY" | sed '/commit<\/strong>/,/<\/li>/ s/\(\)\(.*\)\(<\/code>\)/\2/g') + changed_body=$(echo "$BODY" | sed '/commit<\/strong>/,/<\/li>/ s/\([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 \ No newline at end of file + gh issue edit $ISSUE --body-file body.txt