From 0319285da1ad81c7d0c1778dde00bbd937d99ee6 Mon Sep 17 00:00:00 2001 From: Muhammad Atif Ali Date: Fri, 11 Aug 2023 15:06:02 +0300 Subject: [PATCH 1/4] fix: fix deploying PRs on each push --- .github/workflows/pr-deploy.yaml | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pr-deploy.yaml b/.github/workflows/pr-deploy.yaml index 42146da3a21b9..e183a5d12e780 100644 --- a/.github/workflows/pr-deploy.yaml +++ b/.github/workflows/pr-deploy.yaml @@ -73,7 +73,13 @@ jobs: CODER_BASE_IMAGE_TAG: ${{ steps.set_tags.outputs.CODER_BASE_IMAGE_TAG }} CODER_IMAGE_TAG: ${{ steps.set_tags.outputs.CODER_IMAGE_TAG }} NEW: ${{ steps.check_deployment.outputs.NEW }} - BUILD: ${{ steps.filter.outputs.all_count > steps.filter.outputs.ignored_count || steps.check_deployment.outputs.NEW }} + BUILD: | + ${{ + (steps.filter.outputs.all_count > steps.filter.outputs.ignored_count || + github.event.inputs.build == 'true') && + (github.event_name == 'push' || + steps.check_deployment.outputs.NEW == 'true') + }} runs-on: "ubuntu-latest" steps: @@ -165,12 +171,20 @@ jobs: echo "CODER_BASE_IMAGE_TAG=${{ steps.set_tags.outputs.CODER_BASE_IMAGE_TAG }}" echo "CODER_IMAGE_TAG=${{ steps.set_tags.outputs.CODER_IMAGE_TAG }}" echo "NEW=${{ steps.check_deployment.outputs.NEW }}" - echo "BUILD=${{ steps.filter.outputs.all_count > steps.filter.outputs.ignored_count || steps.check_deployment.outputs.NEW || github.event.inputs.build == 'true' }}" + echo "BUILD= / + ${{ / + (steps.filter.outputs.all_count > steps.filter.outputs.ignored_count || / + github.event.inputs.build == 'true') && / + (github.event_name == 'push' || / + steps.check_deployment.outputs.NEW == 'true') / + }} echo "GITHUB_REF=${{ github.ref }}" comment-pr: needs: [check_pr, get_info] - if: ${{ needs.get_info.outputs.BUILD == 'true' || github.event.inputs.deploy == 'true' || github.event.inputs.build == 'true' }} + if: | + (needs.get_info.outputs.BUILD == 'true' || github.event.inputs.deploy == 'true') && + (github.event. runs-on: "ubuntu-latest" steps: - name: Find Comment From ede5b6d8da436891da1cf73ed0b54e878a6a518e Mon Sep 17 00:00:00 2001 From: Atif Ali Date: Fri, 11 Aug 2023 12:11:21 +0000 Subject: [PATCH 2/4] fix syntax --- .github/workflows/pr-deploy.yaml | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/.github/workflows/pr-deploy.yaml b/.github/workflows/pr-deploy.yaml index e183a5d12e780..77f93f007a6b2 100644 --- a/.github/workflows/pr-deploy.yaml +++ b/.github/workflows/pr-deploy.yaml @@ -74,8 +74,8 @@ jobs: CODER_IMAGE_TAG: ${{ steps.set_tags.outputs.CODER_IMAGE_TAG }} NEW: ${{ steps.check_deployment.outputs.NEW }} BUILD: | - ${{ - (steps.filter.outputs.all_count > steps.filter.outputs.ignored_count || + ${{ + (steps.filter.outputs.all_count > steps.filter.outputs.ignored_count || github.event.inputs.build == 'true') && (github.event_name == 'push' || steps.check_deployment.outputs.NEW == 'true') @@ -171,20 +171,12 @@ jobs: echo "CODER_BASE_IMAGE_TAG=${{ steps.set_tags.outputs.CODER_BASE_IMAGE_TAG }}" echo "CODER_IMAGE_TAG=${{ steps.set_tags.outputs.CODER_IMAGE_TAG }}" echo "NEW=${{ steps.check_deployment.outputs.NEW }}" - echo "BUILD= / - ${{ / - (steps.filter.outputs.all_count > steps.filter.outputs.ignored_count || / - github.event.inputs.build == 'true') && / - (github.event_name == 'push' || / - steps.check_deployment.outputs.NEW == 'true') / - }} + echo "BUILD=${{ (steps.filter.outputs.all_count > steps.filter.outputs.ignored_count || github.event.inputs.build == 'true') && (github.event_name == 'push' || steps.check_deployment.outputs.NEW == 'true') }} echo "GITHUB_REF=${{ github.ref }}" comment-pr: needs: [check_pr, get_info] - if: | - (needs.get_info.outputs.BUILD == 'true' || github.event.inputs.deploy == 'true') && - (github.event. + if: needs.get_info.outputs.BUILD == 'true' || github.event.inputs.deploy == 'true' runs-on: "ubuntu-latest" steps: - name: Find Comment From 27241f02b4f4e301d4831e11be189b6206f6bfa5 Mon Sep 17 00:00:00 2001 From: Atif Ali Date: Fri, 11 Aug 2023 12:12:38 +0000 Subject: [PATCH 3/4] fixup! --- .github/workflows/pr-deploy.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr-deploy.yaml b/.github/workflows/pr-deploy.yaml index 77f93f007a6b2..54d6e28cca220 100644 --- a/.github/workflows/pr-deploy.yaml +++ b/.github/workflows/pr-deploy.yaml @@ -171,7 +171,7 @@ jobs: echo "CODER_BASE_IMAGE_TAG=${{ steps.set_tags.outputs.CODER_BASE_IMAGE_TAG }}" echo "CODER_IMAGE_TAG=${{ steps.set_tags.outputs.CODER_IMAGE_TAG }}" echo "NEW=${{ steps.check_deployment.outputs.NEW }}" - echo "BUILD=${{ (steps.filter.outputs.all_count > steps.filter.outputs.ignored_count || github.event.inputs.build == 'true') && (github.event_name == 'push' || steps.check_deployment.outputs.NEW == 'true') }} + echo "BUILD=${{ (steps.filter.outputs.all_count > steps.filter.outputs.ignored_count || github.event.inputs.build == 'true') && (github.event_name == 'push' || steps.check_deployment.outputs.NEW == 'true') }}" echo "GITHUB_REF=${{ github.ref }}" comment-pr: From 29525e9353bc1a4573d2c1cd16d849b271cf244e Mon Sep 17 00:00:00 2001 From: Atif Ali Date: Fri, 11 Aug 2023 12:29:39 +0000 Subject: [PATCH 4/4] fixup! --- .github/workflows/pr-deploy.yaml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/pr-deploy.yaml b/.github/workflows/pr-deploy.yaml index 54d6e28cca220..8b830ee73e361 100644 --- a/.github/workflows/pr-deploy.yaml +++ b/.github/workflows/pr-deploy.yaml @@ -75,10 +75,11 @@ jobs: NEW: ${{ steps.check_deployment.outputs.NEW }} BUILD: | ${{ - (steps.filter.outputs.all_count > steps.filter.outputs.ignored_count || - github.event.inputs.build == 'true') && - (github.event_name == 'push' || - steps.check_deployment.outputs.NEW == 'true') + (steps.filter.outputs.all_count > steps.filter.outputs.ignored_count) && + ( + (github.event_name == 'push' && steps.check_deployment.outputs.NEW == 'false') || + github.event.inputs.build == 'true' + ) }} runs-on: "ubuntu-latest" @@ -171,7 +172,7 @@ jobs: echo "CODER_BASE_IMAGE_TAG=${{ steps.set_tags.outputs.CODER_BASE_IMAGE_TAG }}" echo "CODER_IMAGE_TAG=${{ steps.set_tags.outputs.CODER_IMAGE_TAG }}" echo "NEW=${{ steps.check_deployment.outputs.NEW }}" - echo "BUILD=${{ (steps.filter.outputs.all_count > steps.filter.outputs.ignored_count || github.event.inputs.build == 'true') && (github.event_name == 'push' || steps.check_deployment.outputs.NEW == 'true') }}" + echo "BUILD=${{ (steps.filter.outputs.all_count > steps.filter.outputs.ignored_count) && ((github.event_name == 'push' && steps.check_deployment.outputs.NEW == 'false') || github.event.inputs.build == 'true') }}" echo "GITHUB_REF=${{ github.ref }}" comment-pr: