Skip to content

fix: update BUILD condition in pr-deploy.yaml #9064

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 19 commits into from
Aug 13, 2023
Prev Previous commit
Next Next commit
more tests
  • Loading branch information
matifali committed Aug 13, 2023
commit 066f3ee78900b5c951b3ebdf161936abe41f0080
31 changes: 7 additions & 24 deletions .github/workflows/pr-deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,7 @@ 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: |
${{
github.event.inputs.build ||
(github.event_name == 'workflow_dispatch' && steps.check_deployment.outputs.NEW == 'true') ||
(github.event_name == 'push' && steps.check_deployment.outputs.NEW == 'false' && steps.filter.outputs.all_count > steps.filter.outputs.ignored_count) ||
(steps.check_deployment.outputs.NEW == 'false' && steps.filter.outputs.all_count > steps.filter.outputs.ignored_count)
}}
BUILD: ${{ steps.build_conditionals.outputs.build_condition_1 == 'true' || steps.build_conditionals.outputs.build_condition_2 == 'true' || steps.build_conditionals.outputs.build_condition_3 == 'true' || steps.build_conditionals.outputs.build_condition_4 == 'true' }}

runs-on: "ubuntu-latest"
steps:
Expand Down Expand Up @@ -161,25 +155,14 @@ jobs:
echo "Total number of changed files: ${{ steps.filter.outputs.all_count }}"
echo "Number of ignored files: ${{ steps.filter.outputs.ignored_count }}"

- name: Debug
- name: Build conditionals
id: build_conditionals
run: |
set -euo pipefail
# Print all inputs of BUILD output
echo "build_input: ${{ github.event.inputs.build }}"
echo "github_event_name: ${{ github.event_name }}"
echo "files_changed: ${{ steps.filter.outputs.all_count > steps.filter.outputs.ignored_count }}"
echo "new_deployment: ${{ steps.check_deployment.outputs.NEW }}"
echo "test_condition_1: ${{ github.event.inputs.build }}"
echo "test_condition_2: ${{ (github.event_name == 'workflow_dispatch' && steps.check_deployment.outputs.NEW == 'true') }}"
echo "test_condition_3: ${{ (github.event_name == 'push' && steps.check_deployment.outputs.NEW == 'false' && steps.filter.outputs.all_count > steps.filter.outputs.ignored_count) }}"
echo "test_condition_4: ${{ (steps.check_deployment.outputs.NEW == 'false' && steps.filter.outputs.all_count > steps.filter.outputs.ignored_count) }}"
echo "BUILD: |
${{
github.event.inputs.build ||
(github.event_name == 'workflow_dispatch' && steps.check_deployment.outputs.NEW == 'true') ||
(github.event_name == 'push' && steps.check_deployment.outputs.NEW == 'false' && steps.filter.outputs.all_count > steps.filter.outputs.ignored_count) ||
(steps.check_deployment.outputs.NEW == 'false' && steps.filter.outputs.all_count > steps.filter.outputs.ignored_count)
}}"
echo "build_condition_1=${{ github.event.inputs.build }}" >> $GITHUB_OUTPUT
echo "build_condition_2=${{ (github.event_name == 'workflow_dispatch' && steps.check_deployment.outputs.NEW == 'true') }}" >> $GITHUB_OUTPUT
echo "build_condition_3=${{ (github.event_name == 'push' && steps.check_deployment.outputs.NEW == 'false' && steps.filter.outputs.all_count > steps.filter.outputs.ignored_count) }}"
echo "build_condition_4=${{ (steps.check_deployment.outputs.NEW == 'false' && steps.filter.outputs.all_count > steps.filter.outputs.ignored_count) }}"

comment-pr:
needs: [check_pr, get_info]
Expand Down