From 72547ba114eca4211b12af20a9b0953e1f5b1931 Mon Sep 17 00:00:00 2001 From: Samir Kamal <1954121+skamril@users.noreply.github.com> Date: Wed, 14 Aug 2024 17:55:31 +0200 Subject: [PATCH] debug --- .github/workflows/main.yml | 36 +++++++++++++++++++++++++++++------- 1 file changed, 29 insertions(+), 7 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 386fcaead7..f003e8cadb 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -78,8 +78,30 @@ jobs: ## npm ################################################################ + check-frontend-changes: + runs-on: ubuntu-20.04 + outputs: + should-run: ${{ steps.check-files.outputs.should-run }} + steps: + - name: Checkout GitHub repo + uses: actions/checkout@v4 + with: + fetch-depth: 0 # Ensure full history is fetched + - name: Determine if files in 'webapp/' were changed + id: check-files + run: | + git fetch origin ${{ github.event.pull_request.base.ref }} --depth=1 + if git diff --name-only origin/${{ github.event.pull_request.base.ref }}...HEAD | grep -q '^webapp/'; then + echo "Files in webapp/ have changed" + echo "should-run=true" >> $GITHUB_OUTPUT + else + echo "No files in webapp/ have changed" + echo "should-run=false" >> $GITHUB_OUTPUT + fi + npm-setup: - if: ${{ contains(github.event.pull_request.files.*.filename, 'webapp/') }} + needs: check-frontend-changes + if: ${{ needs.check-frontend-changes.outputs.should-run == 'true' }} runs-on: ubuntu-20.04 steps: - name: Checkout GitHub repo @@ -102,8 +124,8 @@ jobs: working-directory: webapp npm-lint: - if: ${{ contains(github.event.pull_request.files.*.filename, 'webapp/') }} - needs: npm-setup + needs: [check-frontend-changes, npm-setup] + if: ${{ needs.check-frontend-changes.outputs.should-run == 'true' }} runs-on: ubuntu-20.04 steps: - name: Checkout GitHub repo @@ -123,8 +145,8 @@ jobs: working-directory: webapp npm-test: - if: ${{ contains(github.event.pull_request.files.*.filename, 'webapp/') }} - needs: npm-setup + needs: [check-frontend-changes, npm-setup] + if: ${{ needs.check-frontend-changes.outputs.should-run == 'true' }} runs-on: ubuntu-20.04 steps: - name: Checkout GitHub repo @@ -144,8 +166,8 @@ jobs: working-directory: webapp npm-build: - if: ${{ contains(github.event.pull_request.files.*.filename, 'webapp/') }} - needs: npm-setup + needs: [check-frontend-changes, npm-setup] + if: ${{ needs.check-frontend-changes.outputs.should-run == 'true' }} runs-on: ubuntu-20.04 steps: - name: Checkout GitHub repo