From b0c1293c1f4c557088cb852fba388524f58c3877 Mon Sep 17 00:00:00 2001 From: PPawlowski Date: Fri, 12 Jul 2024 13:50:44 +0200 Subject: [PATCH 1/4] Add pull request comment with diff --- .github/workflows/deploy_helm_chart.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/deploy_helm_chart.yml b/.github/workflows/deploy_helm_chart.yml index 4b9f3b0..93f3c35 100644 --- a/.github/workflows/deploy_helm_chart.yml +++ b/.github/workflows/deploy_helm_chart.yml @@ -247,8 +247,13 @@ jobs: fs.writeFileSync('./summary.md', output); + - name: Add diff summary to pull request + uses: thollander/actions-comment-pull-request@v2 + with: + filePath: ./summary.md + - name: Write the step summary - run: cat ./summary.md >> $GITHUB_STEP_SUMMARY + run: cat >> $GITHUB_STEP_SUMMARY deploy: runs-on: ubuntu-latest From 28f636fd29d054124ce5fe56ecd749b49b1a91c9 Mon Sep 17 00:00:00 2001 From: PPawlowski Date: Fri, 12 Jul 2024 14:16:45 +0200 Subject: [PATCH 2/4] Update comment instead of posting a new one --- .github/workflows/deploy_helm_chart.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/deploy_helm_chart.yml b/.github/workflows/deploy_helm_chart.yml index 93f3c35..0e60594 100644 --- a/.github/workflows/deploy_helm_chart.yml +++ b/.github/workflows/deploy_helm_chart.yml @@ -251,6 +251,7 @@ jobs: uses: thollander/actions-comment-pull-request@v2 with: filePath: ./summary.md + comment_tag: 'helm-diff-${{ inputs.environment }}' - name: Write the step summary run: cat >> $GITHUB_STEP_SUMMARY From cf35d3c91344b3c77e7527f331107d5f65f8a2b7 Mon Sep 17 00:00:00 2001 From: PPawlowski Date: Fri, 12 Jul 2024 15:44:12 +0200 Subject: [PATCH 3/4] Add conditionals to PR comment and job summary --- .github/workflows/deploy_helm_chart.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/deploy_helm_chart.yml b/.github/workflows/deploy_helm_chart.yml index 0e60594..ed124d2 100644 --- a/.github/workflows/deploy_helm_chart.yml +++ b/.github/workflows/deploy_helm_chart.yml @@ -248,12 +248,14 @@ jobs: fs.writeFileSync('./summary.md', output); - name: Add diff summary to pull request + if: github.event_name == 'pull_request' uses: thollander/actions-comment-pull-request@v2 with: filePath: ./summary.md comment_tag: 'helm-diff-${{ inputs.environment }}' - name: Write the step summary + if: github.event_name != 'pull_request' run: cat >> $GITHUB_STEP_SUMMARY deploy: From 4a74fb7decd63fb8550f6aa6691c8a250cf87e9d Mon Sep 17 00:00:00 2001 From: PPawlowski Date: Fri, 12 Jul 2024 15:50:26 +0200 Subject: [PATCH 4/4] Remove job summary step --- .github/workflows/deploy_helm_chart.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/deploy_helm_chart.yml b/.github/workflows/deploy_helm_chart.yml index ed124d2..15002c2 100644 --- a/.github/workflows/deploy_helm_chart.yml +++ b/.github/workflows/deploy_helm_chart.yml @@ -253,10 +253,6 @@ jobs: with: filePath: ./summary.md comment_tag: 'helm-diff-${{ inputs.environment }}' - - - name: Write the step summary - if: github.event_name != 'pull_request' - run: cat >> $GITHUB_STEP_SUMMARY deploy: runs-on: ubuntu-latest