From 2d5448910f10b628974fa6dab3a05bd2e729543c Mon Sep 17 00:00:00 2001 From: Timothy Le Bon Date: Tue, 26 Nov 2024 17:03:29 +0100 Subject: [PATCH] chore: change where total additions were saved --- .github/workflows/precommit.yml | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/.github/workflows/precommit.yml b/.github/workflows/precommit.yml index 0a1752cf36e..b3d163140d5 100644 --- a/.github/workflows/precommit.yml +++ b/.github/workflows/precommit.yml @@ -16,6 +16,7 @@ jobs: outputs: unit_tests_report: ${{ env.UNIT_TEST_REPORT_FILE }} build_artifact: ${{ env.BUILD_ARTIFACT }} + total_additions: ${{ steps.check_additions.outputs.total_additions }} env: BUILD_DIR: server/dist/s3/ @@ -72,10 +73,13 @@ jobs: - name: Check total PR additions id: check_additions run: | - # Parse the JSON response directly without storing in file - total_additions=$(echo '${{ fromJSON(steps.pr_details.outputs.data).additions }}') - echo "Total additions: $total_additions" - echo "total_additions=$total_additions" >> $GITHUB_ENV + # Store response data in variable + response='${{ steps.pr_details.outputs.data }}' + # Parse additions from response + total_additions=$(echo "$response" | jq -r '.additions') + echo "Found total additions: $total_additions" + # Output for subsequent steps + echo "total_additions=$total_additions" >> $GITHUB_OUTPUT deploy_to_aws: name: 'Deploy to live environments' @@ -110,8 +114,8 @@ jobs: if [[ "${{ steps.deploy.outcome }}" == "success" ]]; then echo "✅ Deployment completed successfully" elif [[ "${{ steps.deploy.outcome }}" == "skipped" ]]; then - if [[ "${{ env.total_additions }}" -le 100 ]]; then - echo "⏭️ Deployment was skipped: PR has ${{ env.total_additions }} additions (threshold: 100)" + if [[ "${{ needs.build.outputs.outputs.total_additions }}" -le 100 ]]; then + echo "⏭️ Deployment was skipped: PR has ${{ needs.build.outputs.outputs.total_additions }} additions (threshold: 100)" elif [[ "${{ github.actor }}" == "dependabot[bot]" ]]; then echo "⏭️ Deployment was skipped: PR is from dependabot" else