From 3a1f50ea99ee3290876ae852dae86178f88a326e Mon Sep 17 00:00:00 2001 From: Ben Millar Date: Wed, 14 Aug 2024 10:49:08 +0100 Subject: [PATCH 01/39] Use PR title rather than labels for checking if the PR was created by Snyk --- .github/workflows/gajira.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/gajira.yml b/.github/workflows/gajira.yml index 605a4e54..dc1aef2b 100644 --- a/.github/workflows/gajira.yml +++ b/.github/workflows/gajira.yml @@ -8,7 +8,7 @@ jobs: gajira: name: Raise Jira Issue runs-on: ubuntu-latest - if: ${{ contains(github.event.pull_request.labels, 'snyk') }} + if: ${{ contains(github.event.pull_request.title, 'snyk') }} steps: - name: Login uses: atlassian/gajira-login@master From c0a6d24af899984aeba238017f854ce29abeb5d8 Mon Sep 17 00:00:00 2001 From: Ben Millar Date: Wed, 14 Aug 2024 13:14:01 +0100 Subject: [PATCH 02/39] Improved repo_name formatting --- .github/workflows/gajira.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/gajira.yml b/.github/workflows/gajira.yml index dc1aef2b..45c0c60e 100644 --- a/.github/workflows/gajira.yml +++ b/.github/workflows/gajira.yml @@ -20,7 +20,7 @@ jobs: - name: Process PR data id: process_pr_data run: | - repo_name=$(echo "$GITHUB_REPOSITORY" | cut -d'/' -f2 | sed 's/ *(.*)//') + repo_name=$(echo "$GITHUB_REPOSITORY" | cut -d'/' -f2 pr_body="${{ github.event.pull_request.body }}" stripped_body=$(echo "$pr_body" | sed 's/<[^>]*>//g') From 8f5c44d4ff2a2e539ebcec1bb4fa7ce7e1b5d185 Mon Sep 17 00:00:00 2001 From: Ben Millar Date: Wed, 14 Aug 2024 13:16:25 +0100 Subject: [PATCH 03/39] Fix typo --- .github/workflows/gajira.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/gajira.yml b/.github/workflows/gajira.yml index 45c0c60e..9d1ab0ae 100644 --- a/.github/workflows/gajira.yml +++ b/.github/workflows/gajira.yml @@ -20,7 +20,7 @@ jobs: - name: Process PR data id: process_pr_data run: | - repo_name=$(echo "$GITHUB_REPOSITORY" | cut -d'/' -f2 + repo_name=$(echo "$GITHUB_REPOSITORY" | cut -d'/' -f2) pr_body="${{ github.event.pull_request.body }}" stripped_body=$(echo "$pr_body" | sed 's/<[^>]*>//g') From 6d567ceb05dd6050e4477ea48634ac9e62a2ab20 Mon Sep 17 00:00:00 2001 From: Ben Millar Date: Wed, 14 Aug 2024 13:24:03 +0100 Subject: [PATCH 04/39] Add apostrophes around the stripped_body env variable. --- .github/workflows/gajira.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/gajira.yml b/.github/workflows/gajira.yml index 9d1ab0ae..ca371866 100644 --- a/.github/workflows/gajira.yml +++ b/.github/workflows/gajira.yml @@ -3,6 +3,9 @@ name: Raise Jira Issue on: pull_request: types: [opened] + push: + branches-ignore: + - main jobs: gajira: @@ -26,7 +29,7 @@ jobs: stripped_body=$(echo "$pr_body" | sed 's/<[^>]*>//g') echo "repo_name=$repo_name" >> $GITHUB_ENV - echo "stripped_body=$stripped_body" >> $GITHUB_ENV + echo "stripped_body='$stripped_body"' >> $GITHUB_ENV - name: Create id: create From b7b0549f9334672cea2ebc469cd7e857d709b306 Mon Sep 17 00:00:00 2001 From: Ben Millar Date: Wed, 14 Aug 2024 13:25:30 +0100 Subject: [PATCH 05/39] Start on reopened PR --- .github/workflows/gajira.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/gajira.yml b/.github/workflows/gajira.yml index ca371866..f594b748 100644 --- a/.github/workflows/gajira.yml +++ b/.github/workflows/gajira.yml @@ -2,10 +2,7 @@ name: Raise Jira Issue on: pull_request: - types: [opened] - push: - branches-ignore: - - main + types: [opened, reopened] jobs: gajira: From 9da42504f835ae7c8c036c2364a804ca489ed1a7 Mon Sep 17 00:00:00 2001 From: Ben Millar Date: Wed, 14 Aug 2024 13:29:52 +0100 Subject: [PATCH 06/39] Changed apostrophe order --- .github/workflows/gajira.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/gajira.yml b/.github/workflows/gajira.yml index f594b748..d78bed4c 100644 --- a/.github/workflows/gajira.yml +++ b/.github/workflows/gajira.yml @@ -26,7 +26,7 @@ jobs: stripped_body=$(echo "$pr_body" | sed 's/<[^>]*>//g') echo "repo_name=$repo_name" >> $GITHUB_ENV - echo "stripped_body='$stripped_body"' >> $GITHUB_ENV + echo "stripped_body='$stripped_body'" >> $GITHUB_ENV - name: Create id: create From 09773b681f6a338f8217eafc622e94b8522af4e1 Mon Sep 17 00:00:00 2001 From: Ben Millar Date: Wed, 14 Aug 2024 13:38:09 +0100 Subject: [PATCH 07/39] Remove echo --- .github/workflows/gajira.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/gajira.yml b/.github/workflows/gajira.yml index d78bed4c..f4adb94d 100644 --- a/.github/workflows/gajira.yml +++ b/.github/workflows/gajira.yml @@ -23,7 +23,7 @@ jobs: repo_name=$(echo "$GITHUB_REPOSITORY" | cut -d'/' -f2) pr_body="${{ github.event.pull_request.body }}" - stripped_body=$(echo "$pr_body" | sed 's/<[^>]*>//g') + stripped_body=$("$pr_body" | sed 's/<[^>]*>//g') echo "repo_name=$repo_name" >> $GITHUB_ENV echo "stripped_body='$stripped_body'" >> $GITHUB_ENV From 258b7d56d46350fadec051ef0087936ef860d709 Mon Sep 17 00:00:00 2001 From: Kyle O'Brien <65071578+TawneeOwl@users.noreply.github.com> Date: Wed, 14 Aug 2024 14:45:39 +0100 Subject: [PATCH 08/39] Change functionality --- .github/workflows/gajira.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/gajira.yml b/.github/workflows/gajira.yml index f4adb94d..a2e7475a 100644 --- a/.github/workflows/gajira.yml +++ b/.github/workflows/gajira.yml @@ -20,13 +20,16 @@ jobs: - name: Process PR data id: process_pr_data run: | - repo_name=$(echo "$GITHUB_REPOSITORY" | cut -d'/' -f2) + repo_name=$(basename ${{ github.repository }} pr_body="${{ github.event.pull_request.body }}" - stripped_body=$("$pr_body" | sed 's/<[^>]*>//g') + STRIPPED_BODY=$(node -e " + const sanitizeHtml = require('sanitize-html'); + console.log(sanitizeHtml('$PR_BODY', { allowedTags: [], allowedAttributes: {} })); + ") + echo "::set-output name=clean_body::$STRIPPED_BODY" >> $GITHUB_ENV echo "repo_name=$repo_name" >> $GITHUB_ENV - echo "stripped_body='$stripped_body'" >> $GITHUB_ENV - name: Create id: create From 20f59468a1bad2aa03de1b9de95bb6c86a2bd6e8 Mon Sep 17 00:00:00 2001 From: Kyle O'Brien <65071578+TawneeOwl@users.noreply.github.com> Date: Wed, 14 Aug 2024 14:48:42 +0100 Subject: [PATCH 09/39] Change to python --- .github/workflows/gajira.yml | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/.github/workflows/gajira.yml b/.github/workflows/gajira.yml index a2e7475a..a36ec8e0 100644 --- a/.github/workflows/gajira.yml +++ b/.github/workflows/gajira.yml @@ -23,13 +23,16 @@ jobs: repo_name=$(basename ${{ github.repository }} pr_body="${{ github.event.pull_request.body }}" - STRIPPED_BODY=$(node -e " - const sanitizeHtml = require('sanitize-html'); - console.log(sanitizeHtml('$PR_BODY', { allowedTags: [], allowedAttributes: {} })); - ") - echo "::set-output name=clean_body::$STRIPPED_BODY" >> $GITHUB_ENV + python -c " + import html + import re + import os + clean_body = re.sub(r'<[^>]+>', '', html.unescape(pr_body)) + print(f'::set-output name=clean_body::{clean_body}') + " echo "repo_name=$repo_name" >> $GITHUB_ENV + echo "stripped_body='$clean_body'" >> $GITHUB_ENV - name: Create id: create From 751f2e39d54f523950d651d0a3e2e3bf2a0991ae Mon Sep 17 00:00:00 2001 From: Kyle O'Brien <65071578+TawneeOwl@users.noreply.github.com> Date: Wed, 14 Aug 2024 14:51:05 +0100 Subject: [PATCH 10/39] Add in bracket --- .github/workflows/gajira.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/gajira.yml b/.github/workflows/gajira.yml index a36ec8e0..a1dbe211 100644 --- a/.github/workflows/gajira.yml +++ b/.github/workflows/gajira.yml @@ -20,7 +20,7 @@ jobs: - name: Process PR data id: process_pr_data run: | - repo_name=$(basename ${{ github.repository }} + repo_name=$(basename ${{ github.repository }}) pr_body="${{ github.event.pull_request.body }}" python -c " From 24c9974391209f89311eb041ae4b7f92083346fb Mon Sep 17 00:00:00 2001 From: Kyle O'Brien <65071578+TawneeOwl@users.noreply.github.com> Date: Wed, 14 Aug 2024 14:52:26 +0100 Subject: [PATCH 11/39] Move pr_body --- .github/workflows/gajira.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/gajira.yml b/.github/workflows/gajira.yml index a1dbe211..12f33241 100644 --- a/.github/workflows/gajira.yml +++ b/.github/workflows/gajira.yml @@ -22,12 +22,12 @@ jobs: run: | repo_name=$(basename ${{ github.repository }}) - pr_body="${{ github.event.pull_request.body }}" python -c " import html import re import os + pr_body="${{ github.event.pull_request.body }}" clean_body = re.sub(r'<[^>]+>', '', html.unescape(pr_body)) print(f'::set-output name=clean_body::{clean_body}') " From d9da23f3c64f486ece6cf882f5e947e49898f782 Mon Sep 17 00:00:00 2001 From: Kyle O'Brien <65071578+TawneeOwl@users.noreply.github.com> Date: Wed, 14 Aug 2024 14:54:19 +0100 Subject: [PATCH 12/39] Move pr body --- .github/workflows/gajira.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/gajira.yml b/.github/workflows/gajira.yml index 12f33241..f64310e8 100644 --- a/.github/workflows/gajira.yml +++ b/.github/workflows/gajira.yml @@ -22,12 +22,13 @@ jobs: run: | repo_name=$(basename ${{ github.repository }}) + pr_body="${{ github.event.pull_request.body }}" python -c " import html import re import os - pr_body="${{ github.event.pull_request.body }}" + pr_body = os.getenv('PR_BODY', '') clean_body = re.sub(r'<[^>]+>', '', html.unescape(pr_body)) print(f'::set-output name=clean_body::{clean_body}') " From 29fd23fbbfa1ddbca64de2da48c7aa50f5280980 Mon Sep 17 00:00:00 2001 From: Kyle O'Brien <65071578+TawneeOwl@users.noreply.github.com> Date: Wed, 14 Aug 2024 15:02:32 +0100 Subject: [PATCH 13/39] Sanitize input --- .github/workflows/gajira.yml | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/.github/workflows/gajira.yml b/.github/workflows/gajira.yml index f64310e8..11f3bbef 100644 --- a/.github/workflows/gajira.yml +++ b/.github/workflows/gajira.yml @@ -20,18 +20,11 @@ jobs: - name: Process PR data id: process_pr_data run: | - repo_name=$(basename ${{ github.repository }}) + repo_name=$(basename ${{ github.repository }} - pr_body="${{ github.event.pull_request.body }}" - python -c " - import html - import re - import os - - pr_body = os.getenv('PR_BODY', '') - clean_body = re.sub(r'<[^>]+>', '', html.unescape(pr_body)) - print(f'::set-output name=clean_body::{clean_body}') - " + echo "${{ github.event.pull_request.body }}" > pr_body.txt + clean_body=$(sed 's/<[^>]*>//g' pr_body.txt) + echo "repo_name=$repo_name" >> $GITHUB_ENV echo "stripped_body='$clean_body'" >> $GITHUB_ENV From a88213be9306f188deff6bb8631061b42a7b51e6 Mon Sep 17 00:00:00 2001 From: Kyle O'Brien <65071578+TawneeOwl@users.noreply.github.com> Date: Wed, 14 Aug 2024 15:08:00 +0100 Subject: [PATCH 14/39] Add in bracket --- .github/workflows/gajira.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/gajira.yml b/.github/workflows/gajira.yml index 11f3bbef..e75f187d 100644 --- a/.github/workflows/gajira.yml +++ b/.github/workflows/gajira.yml @@ -20,11 +20,11 @@ jobs: - name: Process PR data id: process_pr_data run: | - repo_name=$(basename ${{ github.repository }} + repo_name=$(basename ${{ github.repository }}) echo "${{ github.event.pull_request.body }}" > pr_body.txt clean_body=$(sed 's/<[^>]*>//g' pr_body.txt) - + echo "repo_name=$repo_name" >> $GITHUB_ENV echo "stripped_body='$clean_body'" >> $GITHUB_ENV From 1adadd35de0c5ce729fcf110b953378202fa39c8 Mon Sep 17 00:00:00 2001 From: Kyle O'Brien <65071578+TawneeOwl@users.noreply.github.com> Date: Wed, 14 Aug 2024 15:18:26 +0100 Subject: [PATCH 15/39] Remove echo --- .github/workflows/gajira.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/gajira.yml b/.github/workflows/gajira.yml index e75f187d..4145b004 100644 --- a/.github/workflows/gajira.yml +++ b/.github/workflows/gajira.yml @@ -22,7 +22,7 @@ jobs: run: | repo_name=$(basename ${{ github.repository }}) - echo "${{ github.event.pull_request.body }}" > pr_body.txt + "${{ github.event.pull_request.body }}" > pr_body.txt clean_body=$(sed 's/<[^>]*>//g' pr_body.txt) echo "repo_name=$repo_name" >> $GITHUB_ENV From ab1d634842f1650893ea706d7a6be3c28873e25c Mon Sep 17 00:00:00 2001 From: Kyle O'Brien <65071578+TawneeOwl@users.noreply.github.com> Date: Wed, 14 Aug 2024 15:21:29 +0100 Subject: [PATCH 16/39] Clean body via txt --- .github/workflows/gajira.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/gajira.yml b/.github/workflows/gajira.yml index 4145b004..ed1bb908 100644 --- a/.github/workflows/gajira.yml +++ b/.github/workflows/gajira.yml @@ -23,10 +23,11 @@ jobs: repo_name=$(basename ${{ github.repository }}) "${{ github.event.pull_request.body }}" > pr_body.txt - clean_body=$(sed 's/<[^>]*>//g' pr_body.txt) + sed 's/<[^>]*>//g' pr_body.txt > clean_body.txt + cleaned_body=$(cat clean_body.txt | sed ':a;N;$!ba;s/\n/\\n/g') echo "repo_name=$repo_name" >> $GITHUB_ENV - echo "stripped_body='$clean_body'" >> $GITHUB_ENV + echo "stripped_body='$cleaned_body'" >> $GITHUB_ENV - name: Create id: create From cd00906c9593a591db236c1d4d4a51b1285dc167 Mon Sep 17 00:00:00 2001 From: Kyle O'Brien <65071578+TawneeOwl@users.noreply.github.com> Date: Wed, 14 Aug 2024 15:30:23 +0100 Subject: [PATCH 17/39] Change body format --- .github/workflows/gajira.yml | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/.github/workflows/gajira.yml b/.github/workflows/gajira.yml index ed1bb908..43086b1b 100644 --- a/.github/workflows/gajira.yml +++ b/.github/workflows/gajira.yml @@ -20,14 +20,10 @@ jobs: - name: Process PR data id: process_pr_data run: | - repo_name=$(basename ${{ github.repository }}) + stripped_body=$("${{ github.event.pull_request.body }}" | sed 's/<[^>]*>//g') - "${{ github.event.pull_request.body }}" > pr_body.txt - sed 's/<[^>]*>//g' pr_body.txt > clean_body.txt - cleaned_body=$(cat clean_body.txt | sed ':a;N;$!ba;s/\n/\\n/g') - - echo "repo_name=$repo_name" >> $GITHUB_ENV - echo "stripped_body='$cleaned_body'" >> $GITHUB_ENV + echo "repo_name=$(basename ${{ github.repository }})" >> $GITHUB_ENV + echo "stripped_body='$stripped_body'" >> $GITHUB_ENV - name: Create id: create From f194bc34f37132be9c278d956af219ff1b2fbc48 Mon Sep 17 00:00:00 2001 From: Kyle O'Brien <65071578+TawneeOwl@users.noreply.github.com> Date: Wed, 14 Aug 2024 15:31:58 +0100 Subject: [PATCH 18/39] Remove PR clean --- .github/workflows/gajira.yml | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/.github/workflows/gajira.yml b/.github/workflows/gajira.yml index 43086b1b..8ac06fea 100644 --- a/.github/workflows/gajira.yml +++ b/.github/workflows/gajira.yml @@ -17,19 +17,11 @@ jobs: JIRA_USER_EMAIL: ${{ secrets.JIRA_USER_EMAIL }} JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN }} - - name: Process PR data - id: process_pr_data - run: | - stripped_body=$("${{ github.event.pull_request.body }}" | sed 's/<[^>]*>//g') - - echo "repo_name=$(basename ${{ github.repository }})" >> $GITHUB_ENV - echo "stripped_body='$stripped_body'" >> $GITHUB_ENV - - name: Create id: create uses: atlassian/gajira-create@master with: project: LGA issuetype: Task - summary: "[Snyk] - ${{ env.repo_name }} - ${{ github.event.pull_request.title }}" - description: ${{ env.stripped_body }} \ No newline at end of file + summary: "[Snyk] - $(basename ${{ github.repository }}) - ${{ github.event.pull_request.title }}" + description: $("${{ github.event.pull_request.body }}" | sed 's/<[^>]*>//g') \ No newline at end of file From c5e7ff8d8d80a6698f5d10f4a76ff1664ebadd09 Mon Sep 17 00:00:00 2001 From: Kyle O'Brien <65071578+TawneeOwl@users.noreply.github.com> Date: Wed, 14 Aug 2024 15:35:06 +0100 Subject: [PATCH 19/39] Fix formatting --- .github/workflows/gajira.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/gajira.yml b/.github/workflows/gajira.yml index 8ac06fea..39fa9267 100644 --- a/.github/workflows/gajira.yml +++ b/.github/workflows/gajira.yml @@ -23,5 +23,5 @@ jobs: with: project: LGA issuetype: Task - summary: "[Snyk] - $(basename ${{ github.repository }}) - ${{ github.event.pull_request.title }}" - description: $("${{ github.event.pull_request.body }}" | sed 's/<[^>]*>//g') \ No newline at end of file + summary: "[Snyk] - '$(basename ${{ github.repository }})' - ${{ github.event.pull_request.title }}" + description: "$('${{ github.event.pull_request.body }}' | sed 's/<[^>]*>//g')" \ No newline at end of file From fff3b3cb5db892479f7bbf5099ada91d0e963acb Mon Sep 17 00:00:00 2001 From: Kyle O'Brien <65071578+TawneeOwl@users.noreply.github.com> Date: Wed, 14 Aug 2024 15:45:24 +0100 Subject: [PATCH 20/39] Try with base name --- .github/workflows/gajira.yml | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/.github/workflows/gajira.yml b/.github/workflows/gajira.yml index 39fa9267..f6605aa4 100644 --- a/.github/workflows/gajira.yml +++ b/.github/workflows/gajira.yml @@ -17,11 +17,21 @@ jobs: JIRA_USER_EMAIL: ${{ secrets.JIRA_USER_EMAIL }} JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN }} + - name: Process PR data + id: process_pr_data + run: | + + pr_body="${{ github.event.pull_request.body }}" + stripped_body=$("$pr_body" | sed 's/<[^>]*>//g') + + echo "repo_name=$(basename ${{ github.repository }})" >> $GITHUB_ENV + echo "stripped_body='$stripped_body'" >> $GITHUB_ENV + - name: Create id: create uses: atlassian/gajira-create@master with: project: LGA issuetype: Task - summary: "[Snyk] - '$(basename ${{ github.repository }})' - ${{ github.event.pull_request.title }}" - description: "$('${{ github.event.pull_request.body }}' | sed 's/<[^>]*>//g')" \ No newline at end of file + summary: "[Snyk] - $(basename ${{ github.repository }}) - ${{ github.event.pull_request.title }}" + description: ${{ env.stripped_body }} \ No newline at end of file From 965abf202d09660352edf380fdcbed7bd4ec1bd7 Mon Sep 17 00:00:00 2001 From: Kyle O'Brien <65071578+TawneeOwl@users.noreply.github.com> Date: Thu, 15 Aug 2024 07:13:29 +0100 Subject: [PATCH 21/39] Remove echo --- .github/workflows/gajira.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/gajira.yml b/.github/workflows/gajira.yml index f6605aa4..7149d132 100644 --- a/.github/workflows/gajira.yml +++ b/.github/workflows/gajira.yml @@ -20,12 +20,11 @@ jobs: - name: Process PR data id: process_pr_data run: | - pr_body="${{ github.event.pull_request.body }}" stripped_body=$("$pr_body" | sed 's/<[^>]*>//g') - echo "repo_name=$(basename ${{ github.repository }})" >> $GITHUB_ENV - echo "stripped_body='$stripped_body'" >> $GITHUB_ENV + "repo_name=$(basename ${{ github.repository }})" >> $GITHUB_ENV + "stripped_body='$stripped_body'" >> $GITHUB_ENV - name: Create id: create @@ -33,5 +32,5 @@ jobs: with: project: LGA issuetype: Task - summary: "[Snyk] - $(basename ${{ github.repository }}) - ${{ github.event.pull_request.title }}" + summary: "[Snyk] - ${{ env.repo_name }} - ${{ github.event.pull_request.title }}" description: ${{ env.stripped_body }} \ No newline at end of file From e5d51d10f882e247e8566e23d6a4dac2912364f8 Mon Sep 17 00:00:00 2001 From: Kyle O'Brien <65071578+TawneeOwl@users.noreply.github.com> Date: Thu, 15 Aug 2024 09:19:06 +0100 Subject: [PATCH 22/39] Add to string --- .github/workflows/gajira.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/gajira.yml b/.github/workflows/gajira.yml index 7149d132..340b1e94 100644 --- a/.github/workflows/gajira.yml +++ b/.github/workflows/gajira.yml @@ -20,8 +20,8 @@ jobs: - name: Process PR data id: process_pr_data run: | - pr_body="${{ github.event.pull_request.body }}" - stripped_body=$("$pr_body" | sed 's/<[^>]*>//g') + 'pr_body="${{ github.event.pull_request.body }}"' + 'stripped_body=$("$pr_body" | sed 's/<[^>]*>//g')' "repo_name=$(basename ${{ github.repository }})" >> $GITHUB_ENV "stripped_body='$stripped_body'" >> $GITHUB_ENV From cbf4252cc034809394265723a140d8f6598ee52e Mon Sep 17 00:00:00 2001 From: Kyle O'Brien <65071578+TawneeOwl@users.noreply.github.com> Date: Thu, 15 Aug 2024 09:35:27 +0100 Subject: [PATCH 23/39] Add in set output --- .github/workflows/gajira.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/gajira.yml b/.github/workflows/gajira.yml index 340b1e94..5e3376b3 100644 --- a/.github/workflows/gajira.yml +++ b/.github/workflows/gajira.yml @@ -20,7 +20,7 @@ jobs: - name: Process PR data id: process_pr_data run: | - 'pr_body="${{ github.event.pull_request.body }}"' + echo '::set-output pr_body="${{ github.event.pull_request.body }}"' 'stripped_body=$("$pr_body" | sed 's/<[^>]*>//g')' "repo_name=$(basename ${{ github.repository }})" >> $GITHUB_ENV From 591ddc852b811adc91b143f9de137a6ac294edbc Mon Sep 17 00:00:00 2001 From: Kyle O'Brien <65071578+TawneeOwl@users.noreply.github.com> Date: Thu, 15 Aug 2024 09:45:31 +0100 Subject: [PATCH 24/39] Change layout of output --- .github/workflows/gajira.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/gajira.yml b/.github/workflows/gajira.yml index 5e3376b3..2cd1284e 100644 --- a/.github/workflows/gajira.yml +++ b/.github/workflows/gajira.yml @@ -20,7 +20,7 @@ jobs: - name: Process PR data id: process_pr_data run: | - echo '::set-output pr_body="${{ github.event.pull_request.body }}"' + echo "::set-output name=pr_body::${{ github.event.pull_request.body }}" 'stripped_body=$("$pr_body" | sed 's/<[^>]*>//g')' "repo_name=$(basename ${{ github.repository }})" >> $GITHUB_ENV From c20592f473896b872f8368ad460709a8b877c7fe Mon Sep 17 00:00:00 2001 From: Kyle O'Brien <65071578+TawneeOwl@users.noreply.github.com> Date: Thu, 15 Aug 2024 09:54:20 +0100 Subject: [PATCH 25/39] Try set output --- .github/workflows/gajira.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/gajira.yml b/.github/workflows/gajira.yml index 2cd1284e..28774f29 100644 --- a/.github/workflows/gajira.yml +++ b/.github/workflows/gajira.yml @@ -21,7 +21,7 @@ jobs: id: process_pr_data run: | echo "::set-output name=pr_body::${{ github.event.pull_request.body }}" - 'stripped_body=$("$pr_body" | sed 's/<[^>]*>//g')' + echo "::set-output name=stripped_body=$('$pr_body' | sed 's/<[^>]*>//g')" "repo_name=$(basename ${{ github.repository }})" >> $GITHUB_ENV "stripped_body='$stripped_body'" >> $GITHUB_ENV From de45b4ed50b7ff47fdcd96293382170079cd36e1 Mon Sep 17 00:00:00 2001 From: Kyle O'Brien <65071578+TawneeOwl@users.noreply.github.com> Date: Thu, 15 Aug 2024 10:05:08 +0100 Subject: [PATCH 26/39] Merge to new version of github output --- .github/workflows/gajira.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/gajira.yml b/.github/workflows/gajira.yml index 28774f29..433e2fb4 100644 --- a/.github/workflows/gajira.yml +++ b/.github/workflows/gajira.yml @@ -20,8 +20,7 @@ jobs: - name: Process PR data id: process_pr_data run: | - echo "::set-output name=pr_body::${{ github.event.pull_request.body }}" - echo "::set-output name=stripped_body=$('$pr_body' | sed 's/<[^>]*>//g')" + echo "pr_body=$(${{ github.event.pull_request.body }} | sed 's/<[^>]*>//g')" >> $GITHUB_OUTPUT "repo_name=$(basename ${{ github.repository }})" >> $GITHUB_ENV "stripped_body='$stripped_body'" >> $GITHUB_ENV From 61fa4867a180ff3980eba3460403d6fdc6d673ab Mon Sep 17 00:00:00 2001 From: Kyle O'Brien <65071578+TawneeOwl@users.noreply.github.com> Date: Thu, 15 Aug 2024 10:10:03 +0100 Subject: [PATCH 27/39] Further change to outputs --- .github/workflows/gajira.yml | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/.github/workflows/gajira.yml b/.github/workflows/gajira.yml index 433e2fb4..c2b88106 100644 --- a/.github/workflows/gajira.yml +++ b/.github/workflows/gajira.yml @@ -20,10 +20,13 @@ jobs: - name: Process PR data id: process_pr_data run: | - echo "pr_body=$(${{ github.event.pull_request.body }} | sed 's/<[^>]*>//g')" >> $GITHUB_OUTPUT + repo_name=$(basename ${{ github.repository }}) + + pr_body="${{ github.event.pull_request.body }}" + stripped_body=$("$pr_body" | sed 's/<[^>]*>//g') - "repo_name=$(basename ${{ github.repository }})" >> $GITHUB_ENV - "stripped_body='$stripped_body'" >> $GITHUB_ENV + echo "repo_name=$repo_name" >> $GITHUB_OUTPUT + echo "stripped_body='$stripped_body'" >> $GITHUB_OUTPUT - name: Create id: create @@ -31,5 +34,5 @@ jobs: with: project: LGA issuetype: Task - summary: "[Snyk] - ${{ env.repo_name }} - ${{ github.event.pull_request.title }}" - description: ${{ env.stripped_body }} \ No newline at end of file + summary: "[Snyk] - ${{ steps.set_outputs.outputs.repo_name }} - ${{ github.event.pull_request.title }}" + description: ${{ steps.set_outputs.outputs.stripped_body }} \ No newline at end of file From 4d40d924b090e45318312d1ae40de26f9bd58781 Mon Sep 17 00:00:00 2001 From: Kyle O'Brien <65071578+TawneeOwl@users.noreply.github.com> Date: Thu, 15 Aug 2024 10:17:03 +0100 Subject: [PATCH 28/39] WIP update --- .github/workflows/gajira.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/gajira.yml b/.github/workflows/gajira.yml index c2b88106..2e31f378 100644 --- a/.github/workflows/gajira.yml +++ b/.github/workflows/gajira.yml @@ -21,12 +21,13 @@ jobs: id: process_pr_data run: | repo_name=$(basename ${{ github.repository }}) - + pr_body="${{ github.event.pull_request.body }}" - stripped_body=$("$pr_body" | sed 's/<[^>]*>//g') + + stripped_body=$(echo "$pr_body" | sed 's/<[^>]*>//g') echo "repo_name=$repo_name" >> $GITHUB_OUTPUT - echo "stripped_body='$stripped_body'" >> $GITHUB_OUTPUT + echo "stripped_body=$stripped_body" >> $GITHUB_OUTPUT - name: Create id: create @@ -34,5 +35,5 @@ jobs: with: project: LGA issuetype: Task - summary: "[Snyk] - ${{ steps.set_outputs.outputs.repo_name }} - ${{ github.event.pull_request.title }}" - description: ${{ steps.set_outputs.outputs.stripped_body }} \ No newline at end of file + summary: "[Snyk] - ${{ steps.process_pr_data.outputs.repo_name }} - ${{ github.event.pull_request.title }}" + description: ${{ steps.process_pr_data.outputs.stripped_body }} \ No newline at end of file From faa08e8bf8407629d6bf31a853e542943f423e18 Mon Sep 17 00:00:00 2001 From: Kyle O'Brien <65071578+TawneeOwl@users.noreply.github.com> Date: Thu, 15 Aug 2024 10:20:14 +0100 Subject: [PATCH 29/39] Add in debug --- .github/workflows/gajira.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/gajira.yml b/.github/workflows/gajira.yml index 2e31f378..3286452a 100644 --- a/.github/workflows/gajira.yml +++ b/.github/workflows/gajira.yml @@ -26,6 +26,8 @@ jobs: stripped_body=$(echo "$pr_body" | sed 's/<[^>]*>//g') + echo "::debug::stripped_body=$stripped_body" + echo "repo_name=$repo_name" >> $GITHUB_OUTPUT echo "stripped_body=$stripped_body" >> $GITHUB_OUTPUT From 6fbc1576b9d89f62db3a7bac34f7c63e1f6e2fc6 Mon Sep 17 00:00:00 2001 From: Kyle O'Brien <65071578+TawneeOwl@users.noreply.github.com> Date: Thu, 15 Aug 2024 10:21:35 +0100 Subject: [PATCH 30/39] remove quotes from pr --- .github/workflows/gajira.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/gajira.yml b/.github/workflows/gajira.yml index 3286452a..55ef4b4a 100644 --- a/.github/workflows/gajira.yml +++ b/.github/workflows/gajira.yml @@ -24,9 +24,7 @@ jobs: pr_body="${{ github.event.pull_request.body }}" - stripped_body=$(echo "$pr_body" | sed 's/<[^>]*>//g') - - echo "::debug::stripped_body=$stripped_body" + stripped_body=$(echo "$pr_body" | sed 's/<[^>]*>//g' | sed "s/'//g" | sed 's/"//g') echo "repo_name=$repo_name" >> $GITHUB_OUTPUT echo "stripped_body=$stripped_body" >> $GITHUB_OUTPUT From 99ad1834472c807dc60d93238ab9a820832cc7af Mon Sep 17 00:00:00 2001 From: Kyle O'Brien <65071578+TawneeOwl@users.noreply.github.com> Date: Thu, 15 Aug 2024 10:24:23 +0100 Subject: [PATCH 31/39] remove quotes --- .github/workflows/gajira.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/gajira.yml b/.github/workflows/gajira.yml index 55ef4b4a..73df39b3 100644 --- a/.github/workflows/gajira.yml +++ b/.github/workflows/gajira.yml @@ -22,10 +22,11 @@ jobs: run: | repo_name=$(basename ${{ github.repository }}) - pr_body="${{ github.event.pull_request.body }}" + pr_body=${{ github.event.pull_request.body }} stripped_body=$(echo "$pr_body" | sed 's/<[^>]*>//g' | sed "s/'//g" | sed 's/"//g') + echo "repo_name=$repo_name" >> $GITHUB_OUTPUT echo "stripped_body=$stripped_body" >> $GITHUB_OUTPUT From 7e42823b6e74eea293a22914205bec228570ebc1 Mon Sep 17 00:00:00 2001 From: Kyle O'Brien <65071578+TawneeOwl@users.noreply.github.com> Date: Thu, 15 Aug 2024 10:26:09 +0100 Subject: [PATCH 32/39] Add in EOF --- .github/workflows/gajira.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/gajira.yml b/.github/workflows/gajira.yml index 73df39b3..e20ae92e 100644 --- a/.github/workflows/gajira.yml +++ b/.github/workflows/gajira.yml @@ -22,10 +22,12 @@ jobs: run: | repo_name=$(basename ${{ github.repository }}) - pr_body=${{ github.event.pull_request.body }} + pr_body=$(cat <]*>//g' | sed "s/'//g" | sed 's/"//g') - + stripped_body=$(echo "$pr_body" | sed 's/<[^>]*>//g') echo "repo_name=$repo_name" >> $GITHUB_OUTPUT echo "stripped_body=$stripped_body" >> $GITHUB_OUTPUT From 4460720a7bb116057a1f2405954ddba565976ea2 Mon Sep 17 00:00:00 2001 From: Kyle O'Brien <65071578+TawneeOwl@users.noreply.github.com> Date: Thu, 15 Aug 2024 10:28:39 +0100 Subject: [PATCH 33/39] Change pr body to txt --- .github/workflows/gajira.yml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/.github/workflows/gajira.yml b/.github/workflows/gajira.yml index e20ae92e..703b4308 100644 --- a/.github/workflows/gajira.yml +++ b/.github/workflows/gajira.yml @@ -22,12 +22,9 @@ jobs: run: | repo_name=$(basename ${{ github.repository }}) - pr_body=$(cat < pr_body.txt - stripped_body=$(echo "$pr_body" | sed 's/<[^>]*>//g') + stripped_body=$(cat pr_body.txt | sed 's/<[^>]*>//g') echo "repo_name=$repo_name" >> $GITHUB_OUTPUT echo "stripped_body=$stripped_body" >> $GITHUB_OUTPUT From 7ee2446ce81957f795aae5e496236c600d1352dc Mon Sep 17 00:00:00 2001 From: Kyle O'Brien <65071578+TawneeOwl@users.noreply.github.com> Date: Thu, 15 Aug 2024 10:31:01 +0100 Subject: [PATCH 34/39] Change to env again --- .github/workflows/gajira.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/gajira.yml b/.github/workflows/gajira.yml index 703b4308..e29c3a58 100644 --- a/.github/workflows/gajira.yml +++ b/.github/workflows/gajira.yml @@ -26,8 +26,8 @@ jobs: stripped_body=$(cat pr_body.txt | sed 's/<[^>]*>//g') - echo "repo_name=$repo_name" >> $GITHUB_OUTPUT - echo "stripped_body=$stripped_body" >> $GITHUB_OUTPUT + echo "repo_name=$repo_name" >> $GITHUB_ENV + echo "stripped_body=$stripped_body" >> $GITHUB_ENV - name: Create id: create @@ -35,5 +35,5 @@ jobs: with: project: LGA issuetype: Task - summary: "[Snyk] - ${{ steps.process_pr_data.outputs.repo_name }} - ${{ github.event.pull_request.title }}" - description: ${{ steps.process_pr_data.outputs.stripped_body }} \ No newline at end of file + summary: "[Snyk] - ${{ env.repo_name }} - ${{ github.event.pull_request.title }}" + description: ${{ env.stripped_body }} \ No newline at end of file From 2669434c0fe159260633229070c3e3a0ed92d5cc Mon Sep 17 00:00:00 2001 From: Kyle O'Brien <65071578+TawneeOwl@users.noreply.github.com> Date: Thu, 15 Aug 2024 10:37:14 +0100 Subject: [PATCH 35/39] WIP 2 --- .github/workflows/gajira.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/gajira.yml b/.github/workflows/gajira.yml index e29c3a58..569a8358 100644 --- a/.github/workflows/gajira.yml +++ b/.github/workflows/gajira.yml @@ -22,9 +22,8 @@ jobs: run: | repo_name=$(basename ${{ github.repository }}) - echo "${{ github.event.pull_request.body }}" > pr_body.txt - - stripped_body=$(cat pr_body.txt | sed 's/<[^>]*>//g') + pr_body="${{ github.event.pull_request.body }}" + stripped_body=$(echo "$pr_body" | sed 's/<[^>]*>//g' | tr '\n' ' ' | tr -s ' ') echo "repo_name=$repo_name" >> $GITHUB_ENV echo "stripped_body=$stripped_body" >> $GITHUB_ENV From de6fe1df98b3d94fa032e00bd181aad407ed22af Mon Sep 17 00:00:00 2001 From: Kyle O'Brien <65071578+TawneeOwl@users.noreply.github.com> Date: Thu, 15 Aug 2024 10:39:56 +0100 Subject: [PATCH 36/39] WIP 3 to json --- .github/workflows/gajira.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/gajira.yml b/.github/workflows/gajira.yml index 569a8358..56770a1e 100644 --- a/.github/workflows/gajira.yml +++ b/.github/workflows/gajira.yml @@ -22,7 +22,7 @@ jobs: run: | repo_name=$(basename ${{ github.repository }}) - pr_body="${{ github.event.pull_request.body }}" + pr_body=$(jq -r '.pull_request.body' <<< '${{ toJson(github.event) }}') stripped_body=$(echo "$pr_body" | sed 's/<[^>]*>//g' | tr '\n' ' ' | tr -s ' ') echo "repo_name=$repo_name" >> $GITHUB_ENV From d47b1d2dbbf355c50c7c583a4b89d767dac24cec Mon Sep 17 00:00:00 2001 From: Kyle O'Brien <65071578+TawneeOwl@users.noreply.github.com> Date: Thu, 15 Aug 2024 10:43:15 +0100 Subject: [PATCH 37/39] Change to txt --- .github/workflows/gajira.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/gajira.yml b/.github/workflows/gajira.yml index 56770a1e..f4c1a031 100644 --- a/.github/workflows/gajira.yml +++ b/.github/workflows/gajira.yml @@ -22,8 +22,8 @@ jobs: run: | repo_name=$(basename ${{ github.repository }}) - pr_body=$(jq -r '.pull_request.body' <<< '${{ toJson(github.event) }}') - stripped_body=$(echo "$pr_body" | sed 's/<[^>]*>//g' | tr '\n' ' ' | tr -s ' ') + echo "${{ github.event.pull_request.body }}" > pr_body.txt + stripped_body=$(sed 's/<[^>]*>//g' pr_body.txt | tr -d '\r' | tr '\n' ' ' | tr -s ' ') echo "repo_name=$repo_name" >> $GITHUB_ENV echo "stripped_body=$stripped_body" >> $GITHUB_ENV From 14714dfa5033c62131883f9060674f50125dc7fc Mon Sep 17 00:00:00 2001 From: Kyle O'Brien <65071578+TawneeOwl@users.noreply.github.com> Date: Thu, 15 Aug 2024 10:44:44 +0100 Subject: [PATCH 38/39] Dont remove spaces --- .github/workflows/gajira.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/gajira.yml b/.github/workflows/gajira.yml index f4c1a031..5817dc80 100644 --- a/.github/workflows/gajira.yml +++ b/.github/workflows/gajira.yml @@ -23,7 +23,7 @@ jobs: repo_name=$(basename ${{ github.repository }}) echo "${{ github.event.pull_request.body }}" > pr_body.txt - stripped_body=$(sed 's/<[^>]*>//g' pr_body.txt | tr -d '\r' | tr '\n' ' ' | tr -s ' ') + stripped_body=$(sed 's/<[^>]*>//g' pr_body.txt) echo "repo_name=$repo_name" >> $GITHUB_ENV echo "stripped_body=$stripped_body" >> $GITHUB_ENV From fd87ea24a867c7e5485e3de72f88604ac98a450a Mon Sep 17 00:00:00 2001 From: Kyle O'Brien <65071578+TawneeOwl@users.noreply.github.com> Date: Thu, 15 Aug 2024 10:45:35 +0100 Subject: [PATCH 39/39] Revert to json --- .github/workflows/gajira.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/gajira.yml b/.github/workflows/gajira.yml index 5817dc80..56770a1e 100644 --- a/.github/workflows/gajira.yml +++ b/.github/workflows/gajira.yml @@ -22,8 +22,8 @@ jobs: run: | repo_name=$(basename ${{ github.repository }}) - echo "${{ github.event.pull_request.body }}" > pr_body.txt - stripped_body=$(sed 's/<[^>]*>//g' pr_body.txt) + pr_body=$(jq -r '.pull_request.body' <<< '${{ toJson(github.event) }}') + stripped_body=$(echo "$pr_body" | sed 's/<[^>]*>//g' | tr '\n' ' ' | tr -s ' ') echo "repo_name=$repo_name" >> $GITHUB_ENV echo "stripped_body=$stripped_body" >> $GITHUB_ENV