From c104508907ece5f957bae158d2c5aad99697e984 Mon Sep 17 00:00:00 2001 From: Christiano Gontijo Date: Tue, 12 Nov 2024 15:13:07 +1300 Subject: [PATCH] GitHub actions (#55) Fixes GHA logic to determine FE / BE changes --- .github/workflows/backend-workflow.yml | 11 +++++------ .github/workflows/compare-changes.yml | 6 +++--- .github/workflows/frontend-workflow.yml | 4 ++-- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/.github/workflows/backend-workflow.yml b/.github/workflows/backend-workflow.yml index 3daa756..5630b72 100644 --- a/.github/workflows/backend-workflow.yml +++ b/.github/workflows/backend-workflow.yml @@ -6,21 +6,20 @@ on: - "master" jobs: - Compare-changes: + compare-changes: uses: ./.github/workflows/compare-changes.yml print-compare-changes-output: runs-on: ubuntu-latest - needs: Compare-changes + needs: compare-changes steps: - run: echo "BackendDisable ${{ needs.compare-changes.outputs.backendDisable }}" - - run: printf "backendDisable ${{ needs.Compare-changes.outputs.backendDisable == 'true' }}\n" - printf "playwrightDisable ${{ needs.Compare-changes.outputs.playwrightDisable == 'true' }}" + - run: printf "should run frontend CI ${{ needs.Compare-changes.outputs.backendDisable == 'false' }}\n" backend-tests: needs: - - Compare-changes - if: ${{ needs.Compare-changes.outputs.backendDisable == 'false' }} + - compare-changes + if: ${{ needs.compare-changes.outputs.backendDisable == 'false' }} runs-on: ubuntu-latest steps: - name: Checkout code diff --git a/.github/workflows/compare-changes.yml b/.github/workflows/compare-changes.yml index 0430915..5a2a247 100644 --- a/.github/workflows/compare-changes.yml +++ b/.github/workflows/compare-changes.yml @@ -3,9 +3,9 @@ on: workflow_call: outputs: backendDisable: - value: ${{ jobs.compare-changes.outputs.backendDisable && jobs.compare-changes.outputs.workflowsNotChanged }} + value: ${{ jobs.compare-changes.outputs.backendDisable && jobs.compare-changes.outputs.workflowsDisable }} frontendDisable: - value: ${{ jobs.compare-changes.outputs.frontendDisable && jobs.compare-changes.outputs.workflowsNotChanged }} + value: ${{ jobs.compare-changes.outputs.frontendDisable && jobs.compare-changes.outputs.workflowsDisable }} playwrightDisable: value: ${{ jobs.compare-changes.outputs.playwrightDisable && jobs.compare-changes.outputs.workflowsDisable && jobs.compare-changes.outputs.backendDisable && jobs.compare-changes.outputs.frontendDisable }} @@ -19,7 +19,7 @@ jobs: backendDisable: ${{ !contains(fromJSON(steps.changed-files.outputs.changes), 'backend') }} frontendDisable: ${{ !contains(fromJSON(steps.changed-files.outputs.changes), 'frontend') }} playwrightDisable: ${{ !contains(fromJSON(steps.changed-files.outputs.changes), 'playwright') }} - workflowsNotChanged: ${{ !contains(fromJSON(steps.changed-files.outputs.changes), 'workflows') }} + workflowsDisable: ${{ !contains(fromJSON(steps.changed-files.outputs.changes), 'workflows') }} steps: - name: Checkout code uses: actions/checkout@v2 diff --git a/.github/workflows/frontend-workflow.yml b/.github/workflows/frontend-workflow.yml index 9845cb8..be2ba74 100644 --- a/.github/workflows/frontend-workflow.yml +++ b/.github/workflows/frontend-workflow.yml @@ -17,8 +17,8 @@ jobs: frontend-test: needs: - - Compare-changes - if: ${{ needs.Compare-changes.outputs.backendDisable == 'false' }} + - compare-changes + if: ${{ needs.compare-changes.outputs.frontendDisable == 'false' }} runs-on: ubuntu-latest defaults: run: