From 44e84894f89ad375a7ff33f31546d988c12bfd17 Mon Sep 17 00:00:00 2001 From: Ayaz-Microsoft Date: Fri, 12 Dec 2025 11:57:43 +0530 Subject: [PATCH] Update workflow paths for Azure Dev, CI, Docker build, and PyLint --- .github/workflows/azure-dev.yml | 6 ++++ .github/workflows/ci.yml | 14 ++++++++ .github/workflows/docker-build-and-push.yml | 37 +++++++++++++++++++++ .github/workflows/pylint.yml | 18 +++++++++- 4 files changed, 74 insertions(+), 1 deletion(-) diff --git a/.github/workflows/azure-dev.yml b/.github/workflows/azure-dev.yml index adf68f0..6db0fbf 100644 --- a/.github/workflows/azure-dev.yml +++ b/.github/workflows/azure-dev.yml @@ -1,5 +1,11 @@ name: AZD Template Validation on: + pull_request: + paths: + - 'azure.yaml' + - 'azure_custom.yaml' + - 'infra/**' + - '.github/workflows/azure-dev.yml' workflow_dispatch: permissions: diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cf80c12..c7f920b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,9 +5,23 @@ on: - main - dev - demo + paths: + - 'infra/**' + - 'azure.yaml' + - 'azure_custom.yaml' + - 'scripts/checkquota.sh' + - 'scripts/quota_check_params.sh' + - '.github/workflows/ci.yml' pull_request: branches: - dev + paths: + - 'infra/**' + - 'azure.yaml' + - 'azure_custom.yaml' + - 'scripts/checkquota.sh' + - 'scripts/quota_check_params.sh' + - '.github/workflows/ci.yml' schedule: - cron: '0 9,21 * * *' # Runs at 9:00 AM and 9:00 PM GMT workflow_dispatch: # Allow manual triggering diff --git a/.github/workflows/docker-build-and-push.yml b/.github/workflows/docker-build-and-push.yml index 703a5dd..e048326 100644 --- a/.github/workflows/docker-build-and-push.yml +++ b/.github/workflows/docker-build-and-push.yml @@ -3,13 +3,47 @@ name: Build and Push Docker Images on: push: branches: [main, dev, demo, hotfix] + paths: + - 'src/backend-api/**' + - 'src/processor/**' + - 'src/frontend/**' + - '.github/workflows/docker-build-and-push.yml' pull_request: branches: [main, dev, demo, hotfix] types: [opened, ready_for_review, reopened, synchronize] + paths: + - 'src/backend-api/**' + - 'src/processor/**' + - 'src/frontend/**' + - '.github/workflows/docker-build-and-push.yml' workflow_dispatch: jobs: + # Detect which services have changes + detect-changes: + runs-on: ubuntu-latest + outputs: + backend-api: ${{ steps.filter.outputs.backend-api }} + processor: ${{ steps.filter.outputs.processor }} + frontend: ${{ steps.filter.outputs.frontend }} + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Check for file changes + uses: dorny/paths-filter@v3 + id: filter + with: + filters: | + backend-api: + - 'src/backend-api/**' + processor: + - 'src/processor/**' + frontend: + - 'src/frontend/**' + build-and-push: + needs: detect-changes runs-on: ubuntu-latest env: ACR_LOGIN_SERVER: ${{ secrets.ACR_LOGIN_SERVER }} @@ -75,6 +109,7 @@ jobs: echo "Base tag: $BASE_TAG, Date tag: $DATE_TAG" - name: Build and Push ContentProcessorAPI Docker image + if: needs.detect-changes.outputs.backend-api == 'true' || github.event_name == 'workflow_dispatch' uses: docker/build-push-action@v6 with: context: ./src/backend-api @@ -85,6 +120,7 @@ jobs: ${{ steps.registry.outputs.ext_registry }}/backend-api:${{ env.DATE_TAG }} - name: Build and Push ContentProcessor Docker image + if: needs.detect-changes.outputs.processor == 'true' || github.event_name == 'workflow_dispatch' uses: docker/build-push-action@v6 with: context: ./src/processor @@ -95,6 +131,7 @@ jobs: ${{ steps.registry.outputs.ext_registry }}/processor:${{ env.DATE_TAG }} - name: Build and Push ContentProcessorWeb Docker image + if: needs.detect-changes.outputs.frontend == 'true' || github.event_name == 'workflow_dispatch' uses: docker/build-push-action@v6 with: context: ./src/frontend diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml index 859a91d..79abb11 100644 --- a/.github/workflows/pylint.yml +++ b/.github/workflows/pylint.yml @@ -1,6 +1,22 @@ name: PyLint -on: [push] +on: + push: + paths: + - '**.py' + - 'src/backend-api/pyproject.toml' + - 'src/processor/pyproject.toml' + - 'src/frontend/requirements.txt' + - '.flake8' + - '.github/workflows/pylint.yml' + pull_request: + paths: + - '**.py' + - 'src/backend-api/pyproject.toml' + - 'src/processor/pyproject.toml' + - 'src/frontend/requirements.txt' + - '.flake8' + - '.github/workflows/pylint.yml' jobs: build: