From cbe114870e281435f46360341f3863b02d0aec4b Mon Sep 17 00:00:00 2001 From: Alliana <56180684+Allianaab2m@users.noreply.github.com> Date: Thu, 23 Jul 2026 07:38:15 +0900 Subject: [PATCH] ci: gate & auto-merge automated emela version bumps Add a pull_request CI workflow (nix flake check + build the pinned emela binary on linux/darwin) and wire the update-emela-pin workflow to enable native auto-merge on the PRs it opens. main now requires the ci check, so bumps merge automatically only once that check is green. --- .github/workflows/ci.yml | 54 ++++++++++++++++++++++++++ .github/workflows/update-emela-pin.yml | 11 ++++++ 2 files changed, 65 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..6a871a2 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,54 @@ +name: ci + +# Gate for pull requests. Because App-authored automation PRs (see +# update-emela-pin.yml) trigger this like any human PR, it doubles as the +# required check that guards auto-merge of the emela version bumps. +on: + pull_request: + workflow_dispatch: + +permissions: + contents: read + +concurrency: + group: ci-${{ github.ref }} + cancel-in-progress: true + +jobs: + build: + strategy: + fail-fast: false + matrix: + include: + - os: ubuntu-latest # x86_64-linux + - os: macos-latest # aarch64-darwin + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v4 + + - uses: DeterminateSystems/nix-installer-action@main + + # Evaluate every flake output (catches eval breakage), but do not build + # the heavy source package here. + - name: flake check (eval only) + run: nix flake check --no-build --show-trace + + # The payload check for a version bump: actually fetch and unpack the + # pinned release binary, verifying the sha256 recorded in versions.json. + - name: build pinned emela binary + run: nix build .#emela --print-build-logs + + # Single, stable status check to require in branch protection. Green only + # when every matrix build above succeeded (a skipped/failed matrix leg fails + # this job, so branch protection cannot be satisfied by a partial run). + ci: + needs: build + if: always() + runs-on: ubuntu-latest + steps: + - name: verify matrix result + run: | + if [ "${{ needs.build.result }}" != "success" ]; then + echo "one or more build jobs did not succeed: ${{ needs.build.result }}" + exit 1 + fi diff --git a/.github/workflows/update-emela-pin.yml b/.github/workflows/update-emela-pin.yml index 180e3a3..afecd22 100644 --- a/.github/workflows/update-emela-pin.yml +++ b/.github/workflows/update-emela-pin.yml @@ -60,6 +60,7 @@ jobs: private-key: ${{ secrets.APP_PRIVATE_KEY }} - name: Open pull request + id: cpr uses: peter-evans/create-pull-request@v6 with: token: ${{ steps.app-token.outputs.token || github.token }} @@ -72,3 +73,13 @@ jobs: branch: automation/emela-update delete-branch: true labels: automation + + # Queue the PR for auto-merge; GitHub merges it once the required `ci` + # check passes. This only works because the PR is App-authored above: + # a GITHUB_TOKEN-authored PR does not trigger the `ci` workflow, so the + # required check would never appear and auto-merge would hang forever. + - name: Enable auto-merge + if: steps.cpr.outputs.pull-request-number != '' + env: + GH_TOKEN: ${{ steps.app-token.outputs.token || github.token }} + run: gh pr merge --squash --auto "${{ steps.cpr.outputs.pull-request-number }}"