From 1157754cf27a627d0dc6ec4ce1852e428c2288c5 Mon Sep 17 00:00:00 2001 From: Saurabh Shrihar Date: Thu, 26 Sep 2024 09:32:09 +0400 Subject: [PATCH] Update deployment to trigger on dev push or hosted/ PR --- .github/workflows/build_and_deploy.yml | 35 +-------------------- .github/workflows/hosted-dev-deployment.yml | 2 +- 2 files changed, 2 insertions(+), 35 deletions(-) diff --git a/.github/workflows/build_and_deploy.yml b/.github/workflows/build_and_deploy.yml index 057cf4c1..199501db 100644 --- a/.github/workflows/build_and_deploy.yml +++ b/.github/workflows/build_and_deploy.yml @@ -32,43 +32,10 @@ on: default: "frontend-dev-ecs-cluster" jobs: - check_files_changed: - runs-on: ubuntu-latest - environment: ${{ inputs.environment }} - if: github.event_name != 'push' - permissions: - id-token: write - contents: write - outputs: - FILES_CHANGED: ${{ steps.changes.outputs.FILES_CHANGED }} - steps: - - name: Authenticate GitHub CLI - run: gh auth login --with-token <<< "${{ secrets.GITHUB_TOKEN }}" - - - name: Checkout Code Repository - uses: actions/checkout@v3 - with: - fetch-depth: 2 - - - name: Get list of changed files - id: changes - run: | - git fetch origin - BASE_BRANCH=${{ github.base_ref }} - echo "Base branch: $BASE_BRANCH" - - # Compare the current branch (HEAD) with the base branch - changed_files=$(git diff --name-only origin/$BASE_BRANCH...HEAD) - echo "FILES_CHANGED=$changed_files" - num_changed_files=$(echo "$changed_files" | wc -l) - echo "Number of Files changed=$num_changed_files" - echo "FILES_CHANGED=$num_changed_files" >> "$GITHUB_OUTPUT" - build_and_deploy: runs-on: ubuntu-latest environment: ${{ inputs.environment }} - needs: [check_files_changed] - if: needs.check_files_changed.outputs.FILES_CHANGED != '' + if: github.event_name != 'push' || startsWith(github.head_ref, 'hosted/') permissions: id-token: write contents: write diff --git a/.github/workflows/hosted-dev-deployment.yml b/.github/workflows/hosted-dev-deployment.yml index fc21e73c..cf32a5b6 100644 --- a/.github/workflows/hosted-dev-deployment.yml +++ b/.github/workflows/hosted-dev-deployment.yml @@ -1,7 +1,7 @@ name: Hosted PR and Dev Deployment on: pull_request: - types: [opened, edited, reopened, synchronize] + types: [opened, reopened, synchronize] push: branches: - dev