From 77c82dfdbdaa69b3a7ae085e1d203ad672ed5537 Mon Sep 17 00:00:00 2001 From: Mohamed Boudra Date: Tue, 12 May 2026 12:57:38 +0700 Subject: [PATCH] ci: split nix into two workflows nix.yml: PR-only build check. nix-update-hash.yml: push-to-main hash update via paseo-ai App token. --- .github/workflows/nix-update-hash.yml | 60 +++++++++++++++++++++++++++ .github/workflows/nix.yml | 56 +------------------------ 2 files changed, 61 insertions(+), 55 deletions(-) create mode 100644 .github/workflows/nix-update-hash.yml diff --git a/.github/workflows/nix-update-hash.yml b/.github/workflows/nix-update-hash.yml new file mode 100644 index 000000000..0acf9ee21 --- /dev/null +++ b/.github/workflows/nix-update-hash.yml @@ -0,0 +1,60 @@ +name: Nix Update Hash + +on: + push: + branches: [main] + paths: + - "nix/**" + - "flake.nix" + - "flake.lock" + - "package.json" + - "package-lock.json" + - "packages/highlight/**" + - "packages/server/**" + - "packages/relay/**" + - "packages/cli/**" + - "scripts/update-nix.sh" + - "scripts/fix-lockfile.mjs" + - ".github/workflows/nix-update-hash.yml" + +permissions: + contents: read + +jobs: + update-hash: + runs-on: ubuntu-latest + steps: + - uses: actions/create-github-app-token@v1 + id: app-token + with: + app-id: ${{ secrets.PASEO_BOT_APP_ID }} + private-key: ${{ secrets.PASEO_BOT_APP_PRIVATE_KEY }} + + - uses: actions/checkout@v4 + with: + ref: ${{ github.ref }} + token: ${{ steps.app-token.outputs.token }} + + - uses: actions/setup-node@v4 + with: + node-version: "22" + cache: "npm" + + - uses: cachix/install-nix-action@v31 + with: + nix_path: nixpkgs=channel:nixos-unstable + + - name: Update lockfile + Nix hash if stale + run: ./scripts/update-nix.sh + + - name: Build Nix package + run: nix build .#default -o result + + - name: Commit hash/lockfile updates + run: | + git diff --quiet package-lock.json nix/npm-deps.hash && exit 0 + git config user.name "paseo-ai[bot]" + git config user.email "266920839+paseo-ai[bot]@users.noreply.github.com" + git add package-lock.json nix/npm-deps.hash + git commit -m "fix: update lockfile signatures and Nix hash [skip ci]" + git push diff --git a/.github/workflows/nix.yml b/.github/workflows/nix.yml index 529e95e0d..04aba7d89 100644 --- a/.github/workflows/nix.yml +++ b/.github/workflows/nix.yml @@ -1,21 +1,6 @@ name: Nix on: - push: - branches: [main] - paths: - - "nix/**" - - "flake.nix" - - "flake.lock" - - "package.json" - - "package-lock.json" - - "packages/highlight/**" - - "packages/server/**" - - "packages/relay/**" - - "packages/cli/**" - - "scripts/update-nix.sh" - - "scripts/fix-lockfile.mjs" - - ".github/workflows/nix.yml" pull_request: branches: [main] paths: @@ -41,7 +26,7 @@ jobs: steps: - uses: actions/checkout@v4 with: - ref: ${{ github.event.pull_request.head.sha || github.ref }} + ref: ${{ github.event.pull_request.head.sha }} - uses: actions/setup-node@v4 with: @@ -57,42 +42,3 @@ jobs: - name: Build Nix package run: nix build .#default -o result - - update-hash: - if: github.event_name == 'push' && github.ref == 'refs/heads/main' - runs-on: ubuntu-latest - steps: - - uses: actions/create-github-app-token@v1 - id: app-token - with: - app-id: ${{ secrets.PASEO_BOT_APP_ID }} - private-key: ${{ secrets.PASEO_BOT_APP_PRIVATE_KEY }} - - - uses: actions/checkout@v4 - with: - ref: ${{ github.ref }} - token: ${{ steps.app-token.outputs.token }} - - - uses: actions/setup-node@v4 - with: - node-version: "22" - cache: "npm" - - - uses: cachix/install-nix-action@v31 - with: - nix_path: nixpkgs=channel:nixos-unstable - - - name: Update lockfile + Nix hash if stale - run: ./scripts/update-nix.sh - - - name: Build Nix package - run: nix build .#default -o result - - - name: Commit hash/lockfile updates - run: | - git diff --quiet package-lock.json nix/npm-deps.hash && exit 0 - git config user.name "paseo-ai[bot]" - git config user.email "266920839+paseo-ai[bot]@users.noreply.github.com" - git add package-lock.json nix/npm-deps.hash - git commit -m "fix: update lockfile signatures and Nix hash [skip ci]" - git push