name: Formatting checks on: pull_request: branches: [release, master] jobs: path-filter: runs-on: ubuntu-latest outputs: server: ${{ steps.filter.outputs.server }} client: ${{ steps.filter.outputs.client }} steps: # Check out merge commit with the base branch in case this workflow is invoked via pull request - name: Checkout the merged commit from PR and base branch uses: actions/checkout@v3 with: ref: refs/pull/${{ github.event.pull_request.number }}/merge - uses: dorny/paths-filter@v2 id: filter with: filters: | server: - 'app/server/**' client: - 'app/client/**' server-formatting: name: server-formatting needs: path-filter if: needs.path-filter.outputs.server == 'true' uses: ./.github/workflows/server-spotless.yml secrets: inherit with: pr: ${{ github.event.pull_request.number }} client-formatting: name: client-formatting needs: path-filter if: needs.path-filter.outputs.client == 'true' uses: ./.github/workflows/client-prettier.yml secrets: inherit with: pr: ${{ github.event.pull_request.number }} formatting-result: name: formatting-result needs: [server-formatting, client-formatting] if: always() runs-on: ubuntu-latest defaults: run: shell: bash steps: - name: Return status for formatting checks run: | if [[ "${{ needs.server-formatting.result }}" == "failure" || "${{ needs.client-formatting.result }}" == "failure" ]]; then echo "Formatting checks failed"; exit 1; else echo "Formatting checks successful"; exit 0; fi