Skip to content

Commit

Permalink
GitHub actions (#55)
Browse files Browse the repository at this point in the history
Fixes GHA logic to determine FE / BE changes
  • Loading branch information
kiwiswift authored Nov 12, 2024
1 parent 052341b commit c104508
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
11 changes: 5 additions & 6 deletions .github/workflows/backend-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/compare-changes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}

Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/frontend-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit c104508

Please sign in to comment.