From da0a166bed2cd3af92fdbcf77e77b68dd175f7b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Ga=C5=82at?= Date: Tue, 16 Apr 2024 12:21:01 +0000 Subject: [PATCH] CI: skip pr in nrf fails CI MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit prevent action from executing if to be skipped Signed-off-by: Robert Gałat --- .../on-pr_nrf_manifest_update_PR.yml | 19 +++++++++++++++++++ .github/workflows/on-pr_publish_comment.yml | 7 ++----- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/.github/workflows/on-pr_nrf_manifest_update_PR.yml b/.github/workflows/on-pr_nrf_manifest_update_PR.yml index 42c2516061..4d583ba4a1 100644 --- a/.github/workflows/on-pr_nrf_manifest_update_PR.yml +++ b/.github/workflows/on-pr_nrf_manifest_update_PR.yml @@ -14,7 +14,26 @@ jobs: GITHUB_CONTEXT: ${{ toJson(github) }} run: echo "$GITHUB_CONTEXT" + - name: Read body of PR + env: + GH_TOKEN: ${{ github.token }} + run: | + gh api -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" /repos/${{github.repository}}/pulls/${{github.event.number}} --jq '.body' > pr_body.md + + - name: Parse body + id: config + shell: bash {0} + run: | + cat pr_body.md + grep -oP "manifest-pr-skip" pr_body.md + if [ $? != 0 ]; then + echo "manifest-pr-skip=false" >> $GITHUB_OUTPUT; + else + echo "manifest-pr-skip=true" >> $GITHUB_OUTPUT; + fi; + - name: Create manifest PR + if: ! ${{ steps.config.outputs.manifest-pr-skip }} uses: nrfconnect/action-manifest-pr@main with: token: ${{ secrets.NCS_GITHUB_TOKEN }} diff --git a/.github/workflows/on-pr_publish_comment.yml b/.github/workflows/on-pr_publish_comment.yml index f1419970eb..1a0b2afefd 100644 --- a/.github/workflows/on-pr_publish_comment.yml +++ b/.github/workflows/on-pr_publish_comment.yml @@ -73,11 +73,8 @@ jobs: sort current/${cfg} > current/${cfg} tr -s '\n' < current/${cfg} > current/${cfg} - printf "\n\n%s\n%-75s|%s\n" "${cfg}" "old" "new" > tmp.md - diff --text --report-identical-files --suppress-common-lines --side-by-side --label old --label new old/${cfg} current/${cfg} >> tmp.md - if [ $? -eq 1 ]; then - cat tmp.md >> memory_usage.md - fi + printf "\n%s\n%-75s|%s\n" "${cfg}" "old" "new" >> memory_usage.md + diff --text --report-identical-files --suppress-common-lines --side-by-side --label old --label new old/${cfg} current/${cfg} >> memory_usage.md done echo "\`\`\`" >> memory_usage.md echo "" >> memory_usage.md