From be3f8f27694f5321217f4ffc2a2ac7bd2567f061 Mon Sep 17 00:00:00 2001 From: Ethan Freestone Date: Tue, 17 Sep 2024 12:23:49 +0100 Subject: [PATCH] ci: JQ json-safety --- .github/workflows/validate-module.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/validate-module.yml b/.github/workflows/validate-module.yml index fd609a4e..b52b96d5 100644 --- a/.github/workflows/validate-module.yml +++ b/.github/workflows/validate-module.yml @@ -59,7 +59,8 @@ jobs: retention-days: 1 - name: Setup validate_module_descriptor_errors file if: failure() - run: echo "$(cat validate_module_descriptor_output.txt)" | tee | grep "\[ERROR\]" 2>&1 | tee validate_module_descriptor_errors.txt + ## Make sure we convert to JSON-safe text before we try to send later + run: echo "$(cat validate_module_descriptor_output.txt)" | tee | grep "\[ERROR\]" | jq -R 2>&1 | tee validate_module_descriptor_errors.txt - name: Comment failures on PR if: failure() run: | @@ -68,4 +69,4 @@ jobs: GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} COMMENT_URL="https://api.github.com/repos/${{ github.repository }}/issues/${PR_NUMBER}/comments" echo "SENDING TO: $COMMENT_URL" - curl -s -H "Authorization: token ${GITHUB_TOKEN}" -X POST $COMMENT_URL --data "@validate_module_descriptor_errors.txt" \ No newline at end of file + curl -s -H "Authorization: token ${GITHUB_TOKEN}" -X POST $COMMENT_URL --data-binary "{ \"body\": \"$(cat validate_module_descriptor_errors.txt)\" }" \ No newline at end of file