build(deps): bump actions/setup-java from 5.5.0 to 5.6.0 in the github-actions group across 1 directory #8
Workflow file for this run
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: "Dependabot PR auto-merge" | |
| on: | |
| pull_request_target: | |
| branches: | |
| - 'main' | |
| env: | |
| LC_ALL: en_US.UTF-8 | |
| defaults: | |
| run: | |
| shell: bash | |
| permissions: | |
| contents: read | |
| jobs: | |
| auto-merge: | |
| if: ${{ github.event.pull_request.user.login == 'dependabot[bot]' && github.repository == 'eclipse-transformer/transformer' }} | |
| permissions: | |
| pull-requests: write | |
| contents: write | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: "Fetch Dependabot Metadata" | |
| id: dependabot-metadata | |
| uses: dependabot/fetch-metadata@25dd0e34f4fe68f24cc83900b1fe3fe149efef98 # v3.1.0 | |
| with: | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: "Wait for PR checks" | |
| id: wait-for-pr-checks | |
| if: ${{ contains(fromJSON('["version-update:semver-minor","version-update:semver-patch"]'), steps.dependabot-metadata.outputs.update-type) }} | |
| run: | | |
| # ---- Config ----------------------------------------------------- | |
| # Name of the current job's check, as it appears in `gh pr checks`. | |
| # Defaults to GITHUB_JOB; override via SELF_CHECK_NAME if the | |
| # displayed check name differs (e.g. "workflow / job" style names). | |
| SELF_CHECK_NAME="${SELF_CHECK_NAME:-${GITHUB_JOB:-}}" | |
| POLL_INTERVAL="${POLL_INTERVAL:-15}" | |
| TIMEOUT="${TIMEOUT:-1800}" | |
| # Comma-separated list of substrings; any check whose name | |
| # CONTAINS one of these substrings is ignored entirely (e.g. | |
| # checks that are known-noisy or irrelevant to gating this PR). | |
| # SELF_CHECK_NAME is always excluded separately above; this list | |
| # is for anything else. | |
| IGNORE_CHECK_NAMES="${IGNORE_CHECK_NAMES:-StepSecurity}" | |
| # Build a JSON array from the comma-separated list for use in jq. | |
| IGNORE_CHECKS_JSON=$(printf '%s\n' "$IGNORE_CHECK_NAMES" | jq -R 'split(",") | map(gsub("^\\s+|\\s+$"; ""))') | |
| # ------------------------------------------------------------------- | |
| if [[ -z "${PR:-}" ]]; then | |
| PR_ARGS=() | |
| else | |
| PR_ARGS=("$PR") | |
| fi | |
| echo "Waiting on checks for PR ${PR:-<inferred>} (excluding check: '${SELF_CHECK_NAME:-none}')" | |
| start_time=$(date +%s) | |
| while true; do | |
| now=$(date +%s) | |
| elapsed=$(( now - start_time )) | |
| if (( elapsed > TIMEOUT )); then | |
| echo "::error::Timed out after ${TIMEOUT}s waiting for checks to complete." | |
| exit 1 | |
| fi | |
| # Pull current checks as JSON, excluding our own check and any | |
| # other checks whose name contains one of the | |
| # IGNORE_CHECK_NAMES substrings. | |
| checks_json=$(gh pr checks "${PR_ARGS[@]}" --json name,state,bucket,link --jq "[.[] | select(.name != \"${SELF_CHECK_NAME}\") | select((.name as \$n | $IGNORE_CHECKS_JSON | any(. as \$s | \$n | contains(\$s))) | not)]") | |
| total=$(jq 'length' <<<"$checks_json") | |
| if (( total == 0 )); then | |
| echo "No other checks found on this PR." | |
| exit 0 | |
| fi | |
| pending=$(jq '[.[] | select(.bucket == "pending" or .state == "IN_PROGRESS" or .state == "QUEUED")] | length' <<<"$checks_json") | |
| failed=$(jq '[.[] | select(.bucket == "fail")]' <<<"$checks_json") | |
| failed_count=$(jq 'length' <<<"$failed") | |
| echo "[$(date -u +%H:%M:%S)] ${total} check(s) tracked, ${pending} still pending, ${failed_count} failed so far." | |
| # Fail fast as soon as any check reports a failure. | |
| if (( failed_count > 0 )); then | |
| echo "::error::One or more checks failed:" | |
| jq -r '.[] | " - \(.name): \(.state) (\(.link))"' <<<"$failed" | |
| exit 1 | |
| fi | |
| if (( pending == 0 )); then | |
| echo "All checks completed successfully." | |
| exit 0 | |
| fi | |
| sleep "$POLL_INTERVAL" | |
| done | |
| env: | |
| PR: ${{ github.event.pull_request.html_url }} | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: "Auto Merge" | |
| if: ${{ steps.wait-for-pr-checks.outcome == 'success' }} | |
| run: | | |
| gh pr merge "$PR" --auto --merge | |
| env: | |
| PR: ${{ github.event.pull_request.html_url }} | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |