deps: bump the minor-and-patch group across 2 directories with 10 updates #402
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Test Java Frameworks | |
| on: | |
| push: | |
| branches: [main] | |
| # No paths filter on pull_request — required status checks need this workflow to | |
| # always trigger so the aggregator can report. find-projects below narrows the | |
| # matrix to only projects whose subtree changed, so docs-only / other-framework | |
| # PRs produce an empty matrix → test job skipped → aggregator passes via | |
| # `result == 'skipped'`. | |
| pull_request: | |
| schedule: | |
| - cron: "0 8 * * 1" | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| # Needed by find-projects' `gh api .../pulls/N/files` call. | |
| pull-requests: read | |
| jobs: | |
| find-projects: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| matrix: ${{ steps.find.outputs.matrix }} | |
| steps: | |
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7 | |
| # Default shallow checkout — we only need the working tree for `find` | |
| # below, not git history. The PR's changed files come from gh api. | |
| - id: find | |
| env: | |
| EVENT_NAME: ${{ github.event_name }} | |
| PR_NUMBER: ${{ github.event.pull_request.number }} | |
| WORKFLOW_FILE: .github/workflows/test-java.yml | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| set -euo pipefail | |
| ALL=$(find samples -name "pom.xml" -not -path "*/target/*" -not -path "*/node_modules/*" -exec dirname {} \; 2>/dev/null | sort) | |
| if [ "$EVENT_NAME" = "pull_request" ]; then | |
| CHANGED=$(gh api --paginate "/repos/$GITHUB_REPOSITORY/pulls/$PR_NUMBER/files" --jq '.[].filename' 2>/dev/null || echo "") | |
| if printf '%s\n' "$CHANGED" | grep -qFx "$WORKFLOW_FILE"; then | |
| FILTERED="$ALL" | |
| else | |
| FILTERED=$(while IFS= read -r proj; do | |
| [ -z "$proj" ] && continue | |
| if printf '%s\n' "$CHANGED" | grep -q "^${proj}/"; then | |
| echo "$proj" | |
| fi | |
| done <<< "$ALL") | |
| fi | |
| else | |
| FILTERED="$ALL" | |
| fi | |
| MATRIX=$(printf '%s\n' "$FILTERED" | jq -R -s -c 'split("\n") | map(select(. != ""))') | |
| echo "matrix=$MATRIX" >> "$GITHUB_OUTPUT" | |
| test: | |
| needs: find-projects | |
| if: ${{ needs.find-projects.outputs.matrix != '[]' }} | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| project: ${{ fromJson(needs.find-projects.outputs.matrix) }} | |
| steps: | |
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7 | |
| - uses: actions/setup-java@1bcf9fb12cf4aa7d266a90ae39939e61372fe520 # v5 | |
| with: | |
| distribution: "temurin" | |
| java-version: "21" | |
| cache: "maven" | |
| - name: Build and test | |
| working-directory: ${{ matrix.project }} | |
| run: mvn -B verify | |
| # Stable aggregator for branch protection. | |
| all-tests-passed: | |
| name: Java tests passed | |
| needs: test | |
| if: always() | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Verify test matrix succeeded | |
| if: needs.test.result != 'success' && needs.test.result != 'skipped' | |
| run: exit 1 |