diff --git a/.github/workflows/auto-merge.yml b/.github/workflows/auto-merge.yml index 404713c..745b874 100644 --- a/.github/workflows/auto-merge.yml +++ b/.github/workflows/auto-merge.yml @@ -47,9 +47,24 @@ jobs: if: ${{ github.event_name == 'pull_request_target' }} run: | set -euo pipefail + protected=$(gh api "repos/$GH_REPO/branches/$BASE" \ + --jq '.protection.required_status_checks.contexts | length') + ruleset=$(gh api "repos/$GH_REPO/rules/branches/$BASE" \ + --jq '[.[] | select(.type == "required_status_checks")] | length') + if [ $((protected + ruleset)) -gt 0 ]; then + echo "$BASE requires status checks, enabling auto-merge" + gh pr merge --auto --squash "$PR" + exit 0 + fi + echo "$BASE has no required status checks, waiting for CI before merging" while true; do - checks=$(gh pr checks "$PR" --json name,bucket \ - --jq '[.[] | select(.name != "auto-merge" and .name != "auto-approve-bot-prs")]' 2>/dev/null || true) + if ! checks=$(gh pr checks "$PR" --json name,bucket \ + --jq '[.[] | select(.name != "auto-merge" and .name != "auto-approve-bot-prs")]' 2>&1); then + case "$checks" in + *"no checks reported"*) checks='[]' ;; + *) echo "$checks" >&2; exit 1 ;; + esac + fi checks=${checks:-[]} total=$(jq length <<< "$checks") pending=$(jq '[.[] | select(.bucket == "pending")] | length' <<< "$checks") @@ -70,6 +85,7 @@ jobs: GH_TOKEN: ${{ steps.generate-token.outputs.token || secrets.GITHUB_TOKEN }} GH_REPO: ${{ github.repository }} PR: ${{ github.event.number }} + BASE: ${{ github.event.pull_request.base.ref }} - name: Backfill auto-merge for existing bot PRs if: ${{ github.event_name == 'workflow_dispatch' }} run: | diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 345300a..6bc69fb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -32,7 +32,7 @@ jobs: - name: Install libuv run: sudo apt-get update && sudo apt-get install -y libuv1-dev - name: Setup Scala - uses: actions/setup-java@v6.0.1 + uses: actions/setup-java@v6.1.0 with: distribution: corretto java-version: '17' @@ -40,7 +40,7 @@ jobs: - name: Setup SBT uses: sbt/setup-sbt@v1.5.7 - name: Cache Dependencies - uses: coursier/cache-action@v8.1.1 + uses: coursier/cache-action@v8.2.0 - name: Check all code compiles run: sbt --no-colors +Test/compile - name: Check artifacts build process @@ -61,7 +61,7 @@ jobs: - name: Install libuv run: sudo apt-get update && sudo apt-get install -y libuv1-dev - name: Setup Scala - uses: actions/setup-java@v6.0.1 + uses: actions/setup-java@v6.1.0 with: distribution: corretto java-version: '17' @@ -69,7 +69,7 @@ jobs: - name: Setup SBT uses: sbt/setup-sbt@v1.5.7 - name: Cache Dependencies - uses: coursier/cache-action@v8.1.1 + uses: coursier/cache-action@v8.2.0 - name: Check if the site workflow is up to date run: sbt --no-colors ciCheckGithubWorkflow - name: Lint @@ -97,7 +97,7 @@ jobs: - name: Install libuv run: sudo apt-get update && sudo apt-get install -y libuv1-dev - name: Setup Scala - uses: actions/setup-java@v6.0.1 + uses: actions/setup-java@v6.1.0 with: distribution: corretto java-version: ${{ matrix.java }} @@ -105,7 +105,7 @@ jobs: - name: Setup SBT uses: sbt/setup-sbt@v1.5.7 - name: Cache Dependencies - uses: coursier/cache-action@v8.1.1 + uses: coursier/cache-action@v8.2.0 - name: Git Checkout uses: actions/checkout@v7.0.1 with: @@ -128,7 +128,7 @@ jobs: - name: Install libuv run: sudo apt-get update && sudo apt-get install -y libuv1-dev - name: Setup Scala - uses: actions/setup-java@v6.0.1 + uses: actions/setup-java@v6.1.0 with: distribution: corretto java-version: '17' @@ -136,7 +136,7 @@ jobs: - name: Setup SBT uses: sbt/setup-sbt@v1.5.7 - name: Cache Dependencies - uses: coursier/cache-action@v8.1.1 + uses: coursier/cache-action@v8.2.0 - name: Generate Readme run: sbt --no-colors docs/generateReadme - name: Generate Token @@ -204,7 +204,7 @@ jobs: - name: Install libuv run: sudo apt-get update && sudo apt-get install -y libuv1-dev - name: Setup Scala - uses: actions/setup-java@v6.0.1 + uses: actions/setup-java@v6.1.0 with: distribution: corretto java-version: '17' @@ -212,7 +212,7 @@ jobs: - name: Setup SBT uses: sbt/setup-sbt@v1.5.7 - name: Cache Dependencies - uses: coursier/cache-action@v8.1.1 + uses: coursier/cache-action@v8.2.0 - name: Release run: sbt --no-colors ci-release env: @@ -235,7 +235,7 @@ jobs: - name: Install libuv run: sudo apt-get update && sudo apt-get install -y libuv1-dev - name: Setup Scala - uses: actions/setup-java@v6.0.1 + uses: actions/setup-java@v6.1.0 with: distribution: corretto java-version: '17' @@ -243,11 +243,11 @@ jobs: - name: Setup SBT uses: sbt/setup-sbt@v1.5.7 - name: Cache Dependencies - uses: coursier/cache-action@v8.1.1 + uses: coursier/cache-action@v8.2.0 - name: Setup NodeJs - uses: actions/setup-node@v7.0.0 + uses: actions/setup-node@v7.1.0 with: - node-version: 24.12.0 + node-version: 24.22.1 registry-url: https://registry.npmjs.org - name: Publish Docs to NPM Registry run: sbt --no-colors docs/publishToNpm diff --git a/.github/workflows/regenerate-workflows.yml b/.github/workflows/regenerate-workflows.yml index 05914cb..64150f5 100644 --- a/.github/workflows/regenerate-workflows.yml +++ b/.github/workflows/regenerate-workflows.yml @@ -45,7 +45,7 @@ jobs: fetch-depth: '0' token: ${{ steps.generate-token.outputs.token || secrets.GITHUB_TOKEN }} - name: Setup Scala - uses: actions/setup-java@v6.0.1 + uses: actions/setup-java@v6.1.0 with: distribution: corretto java-version: '17' @@ -53,7 +53,7 @@ jobs: - name: Setup SBT uses: sbt/setup-sbt@v1.5.7 - name: Cache Dependencies - uses: coursier/cache-action@v8.1.1 + uses: coursier/cache-action@v8.2.0 - name: Regenerate GitHub workflow files run: sbt --no-colors ciGenerateGithubWorkflow - name: Commit and push the regenerated files if changed diff --git a/project/plugins.sbt b/project/plugins.sbt index fe7076b..18ec759 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -5,7 +5,7 @@ addSbtPlugin("com.github.sbt" % "sbt-unidoc" % "0.6.1") addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "2.5.0") addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.13.2") addSbtPlugin("com.github.sbt" % "sbt-native-packager" % "1.13.0") -addSbtPlugin("dev.zio" % "zio-sbt-website" % "0.8.6") -addSbtPlugin("dev.zio" % "zio-sbt-ci" % "0.8.6") +addSbtPlugin("dev.zio" % "zio-sbt-website" % "0.8.7") +addSbtPlugin("dev.zio" % "zio-sbt-ci" % "0.8.7") resolvers += Resolver.sonatypeRepo("public")