Skip to content

Commit b47a31a

Browse files
authored
ci: migrate workflows to Blacksmith (#1249)
* ci: migrate workflows to Blacksmith Move CI, release preparation, scheduled automation, and lightweight gate jobs onto Blacksmith runners. Keep macOS Intel and Windows ARM only in the release native package matrix because those runner families are not available on Blacksmith. Replace nix-community/cache-nix-action with a pinned useblacksmith/stickydisk mount for the Linux /nix store, using stable package/dev keys per runner architecture so Nix builds reuse persistent store state on every Blacksmith Linux job. Replace the old GitHub Actions cache cleanup workflow with weekly Blacksmith sticky disk Nix garbage collection for package and dev profiles, deleting store paths older than seven days. Split npm release publishing so Blacksmith restores native artifacts and packs npm tarballs, while the final GitHub-hosted job only runs pnpm publish with provenance for OIDC trusted publishing. * ci: harden Blacksmith workflow credentials Address CodeRabbit feedback by avoiding persisted checkout credentials in release/cache maintenance jobs, disabling setup-node package-manager caching in the OIDC publish job, and tightening the temporary /nix mount point permission before stickydisk mounts. * ci: share Nix sticky disks per platform Remove the cache-profile input from the setup-nix action so each OS and architecture uses one shared /nix sticky disk. The Nix store is content-addressed and safe to share within the platform scope, so keeping separate package and dev profiles only fragments the cache and doubles GC work. Simplify the weekly sticky disk GC matrix to match the shared Linux platform keys. Restore the npm publish job shape to the existing GitHub-hosted OIDC publishing flow; only the native package build jobs need the Blacksmith runner migration. * ci: tighten Blacksmith workflow migration Switch the PR gate away from pull_request_target so the contributor gate no longer runs as a privileged target workflow. It stays on the lightweight Blacksmith runner because the job does not need a larger machine. Enumerate the Blacksmith labels in actionlint so typos are caught during workflow linting. Limit the PR preview package publish to the native packages actually built on PRs; release still builds and publishes the full platform set. Keep npm release publishing on the existing GitHub-hosted OIDC path. For sticky disk Nix setup, fix mounted /nix ownership after the disk is attached so the single-user Nix installer can write to the store without using a world-writable mount point. * ci: fix sticky disk mounts Remove the unsupported commit input from the pinned useblacksmith/stickydisk action and recreate /nix/store after the sticky disk is mounted before fixing ownership. The mounted filesystem can replace the pre-created directory tree, so /nix/store must be created after mount to avoid Linux ARM setup failures. Drop the remaining actions/cache based Cargo cache from Windows native package builds. The Blacksmith sticky disk action is documented as an ext4 mounted disk and the pinned implementation shells out to mkfs.ext4 and mount, so Windows native runners cannot safely use it as a direct replacement. Restore action-timeline to the main-branch ubuntu-slim runner because that reporting job does not need Blacksmith capacity. * ci: keep lightweight jobs on ubuntu-slim Restore the lightweight PR gate, issue gate, contributor approval, PR title, code-change detection, and action timeline jobs to the GitHub-hosted ubuntu-slim runner. These jobs only run small GitHub API or reporting work and do not benefit from Blacksmith capacity. Keep the actionlint Blacksmith runner allow-list limited to the heavy runners that remain in use after moving lightweight jobs back to ubuntu-slim. * ci: harden release workflow credentials Disable persisted checkout credentials in the npm publish and release jobs, and disable setup-node package manager caching in the npm publish job. This keeps the existing GitHub-hosted OIDC publish flow intact while addressing CodeRabbit credential and cache-poisoning findings. Remove the global SC2016 actionlint suppression and scope the shellcheck directive to the two inline Node.js command substitutions that intentionally use single-quoted JavaScript. * ci: restore Windows Cargo cache Restore actions/cache for Windows Cargo builds in CI and release. Blacksmith documentation says official GitHub cache actions transparently use Blacksmith colocated cache on Blacksmith runners and recommends upstream cache actions over archived useblacksmith cache forks. Do not use useblacksmith/stickydisk for Windows Cargo because the sticky disk documentation describes ext4 filesystem mounts and the pinned action implementation formats and mounts ext4 block devices. Nix store caching remains on sticky disk as requested. * ci: cache node modules on Blacksmith Mount the root node_modules directory on a Blacksmith sticky disk for Linux jobs that use setup-nix. The sticky disk key includes the pnpm version from package.json plus runner OS and architecture so dependency layout changes from a pnpm upgrade do not reuse the old disk. Gate sticky disk mounts on the Blacksmith sticky disk token so GitHub-hosted jobs continue to use normal setup. Add a macOS /nix cache inside setup-nix using the upstream cache action because the sticky disk action is Linux/ext4 oriented. * ci: restore macOS Nix cache action Use nix-community/cache-nix-action for macOS Nix store caching instead of a raw /nix actions/cache restore. The original Nix cache action handles the store safely on macOS, while Linux Blacksmith jobs continue to use sticky disk for /nix. Keep the cache key shared per OS and architecture without reintroducing the old package/dev cache profile split. * ci: fix macOS Nix cache gc input Use gc-max-store-size-macos for the macOS nix-community/cache-nix-action path. The previous Linux-specific input was ignored on macOS, so the cache save path would not run the intended size-based store GC. * ci: rotate Windows Cargo cache saves Include the workflow run id and attempt in the Windows Cargo cache primary key so actions/cache saves updated cargo registry, git, and target contents after each build. Keep lockfile/toolchain-scoped restore keys first so runs still restore from the nearest compatible cache. * ci: stabilize preview package e2e Restore the Nix store before macOS preview E2E runs so the Nix-built native package can find its linked store libraries in CI. This keeps the Blacksmith macOS preview check aligned with the native package build environment. Disable pnpm minimumReleaseAge for preview-package dlx checks. The E2E intentionally installs just-published pkg.pr.new and npm packages, so the workspace-wide age gate rejects valid fresh preview dependencies. * fix(nix): detach darwin binary from nix libiconv Rewrite the Darwin ccusage binary install name from the Nix-provided libiconv path to the macOS system libiconv path during package installation. This keeps Nix as the release build environment while producing a package that runs on macOS machines without the corresponding /nix/store path. The preview package E2E no longer installs Nix on macOS, so it continues to verify the distributed package in a clean runtime environment. Fixes #1251 * ci: split native package build actions Move the native package build flow out of duplicated CI and release workflow steps into platform-specific composite actions for Linux, macOS, and Windows. Keep Blacksmith StickyDisk setup isolated to the Linux setup action, keep macOS on the original Nix cache action, and keep Windows Cargo cache setup separate so each platform path is easier to audit. * ci: build intel mac package without nix Keep macOS ARM on the Nix build path, where the Blacksmith runner is fast enough and the macOS Nix cache is useful. Build the release-only Intel macOS package with Cargo instead, matching the Windows native package path and avoiding slow GitHub-hosted Intel mac Nix setup and cache behavior. * ci: split macos native build actions Replace the macOS build action input switch with separate Nix and Cargo composite actions. The CI macOS ARM build continues to use the Nix action, release macOS ARM uses the same path, and release Intel macOS calls the Cargo action so it avoids slow Nix setup and cache behavior on the GitHub-hosted Intel runner. * ci: avoid template expansion in native actions Pass composite action inputs through environment variables before shell execution so zizmor does not treat arch and binary values as attacker-controllable template injection.
1 parent caab151 commit b47a31a

16 files changed

Lines changed: 379 additions & 194 deletions

File tree

‎.github/actionlint.yaml‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
self-hosted-runner:
2+
labels:
3+
- blacksmith-12vcpu-macos-26
4+
- blacksmith-32vcpu-ubuntu-2404
5+
- blacksmith-32vcpu-ubuntu-2404-arm
6+
- blacksmith-32vcpu-windows-2025
7+
8+
paths:
9+
.github/workflows/*.{yaml,yml}:
10+
ignore:
11+
- 'unknown permission scope "code-quality"'
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Build Linux native package
2+
description: Build, stage, archive, and upload a Linux ccusage native package
3+
inputs:
4+
arch:
5+
description: Native package architecture
6+
required: true
7+
binary:
8+
description: Path to the built ccusage binary
9+
required: true
10+
nix-github-token:
11+
description: Whether Nix builds may use the GitHub token from Nix config
12+
default: 'true'
13+
runs:
14+
using: composite
15+
steps:
16+
- uses: ./.github/actions/setup-nix
17+
18+
- name: Build Linux static binary
19+
shell: bash
20+
env:
21+
NIX_GITHUB_TOKEN: ${{ inputs.nix-github-token }}
22+
run: |
23+
if [ "$NIX_GITHUB_TOKEN" = "false" ]; then
24+
NIX_CONFIG="access-tokens =" nix build .#ccusage-static
25+
else
26+
nix build .#ccusage-static
27+
fi
28+
29+
- name: Verify Linux binary is static
30+
shell: bash
31+
env:
32+
BINARY: ${{ inputs.binary }}
33+
run: |
34+
file "$BINARY"
35+
if ldd "$BINARY" > "$RUNNER_TEMP/ldd.txt" 2>&1; then
36+
cat "$RUNNER_TEMP/ldd.txt"
37+
grep -Eiq 'not a dynamic executable|statically linked' "$RUNNER_TEMP/ldd.txt"
38+
else
39+
cat "$RUNNER_TEMP/ldd.txt"
40+
grep -Eiq 'not a dynamic executable|statically linked' "$RUNNER_TEMP/ldd.txt"
41+
fi
42+
43+
- name: Stage native package
44+
shell: bash
45+
env:
46+
ARCH: ${{ inputs.arch }}
47+
BINARY: ${{ inputs.binary }}
48+
run: node apps/ccusage/scripts/stage-native-package.mjs --platform linux --arch "$ARCH" --binary "$BINARY"
49+
50+
- name: Archive native package binary
51+
shell: bash
52+
env:
53+
ARCH: ${{ inputs.arch }}
54+
run: tar -cf "ccusage-native-linux-$ARCH.tar" "packages/ccusage-linux-$ARCH/bin"
55+
56+
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
57+
with:
58+
name: ccusage-native-linux-${{ inputs.arch }}
59+
path: ccusage-native-linux-${{ inputs.arch }}.tar
60+
if-no-files-found: error
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Build macOS Cargo native package
2+
description: Build, stage, archive, and upload a macOS ccusage native package with Cargo
3+
inputs:
4+
arch:
5+
description: Native package architecture
6+
required: true
7+
binary:
8+
description: Path to the built ccusage binary
9+
required: true
10+
runs:
11+
using: composite
12+
steps:
13+
- name: Build macOS Cargo binary
14+
shell: bash
15+
run: cargo build --manifest-path rust/Cargo.toml --release --bin ccusage
16+
17+
- name: Stage native package
18+
shell: bash
19+
env:
20+
ARCH: ${{ inputs.arch }}
21+
BINARY: ${{ inputs.binary }}
22+
run: node apps/ccusage/scripts/stage-native-package.mjs --platform darwin --arch "$ARCH" --binary "$BINARY"
23+
24+
- name: Archive native package binary
25+
shell: bash
26+
env:
27+
ARCH: ${{ inputs.arch }}
28+
run: tar -cf "ccusage-native-darwin-$ARCH.tar" "packages/ccusage-darwin-$ARCH/bin"
29+
30+
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
31+
with:
32+
name: ccusage-native-darwin-${{ inputs.arch }}
33+
path: ccusage-native-darwin-${{ inputs.arch }}.tar
34+
if-no-files-found: error
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Build macOS Nix native package
2+
description: Build, stage, archive, and upload a macOS ccusage native package with Nix
3+
inputs:
4+
arch:
5+
description: Native package architecture
6+
required: true
7+
binary:
8+
description: Path to the built ccusage binary
9+
required: true
10+
runs:
11+
using: composite
12+
steps:
13+
- uses: ./.github/actions/setup-nix
14+
15+
- name: Build macOS binary
16+
shell: bash
17+
run: nix build .#ccusage
18+
19+
- name: Stage native package
20+
shell: bash
21+
env:
22+
ARCH: ${{ inputs.arch }}
23+
BINARY: ${{ inputs.binary }}
24+
run: node apps/ccusage/scripts/stage-native-package.mjs --platform darwin --arch "$ARCH" --binary "$BINARY"
25+
26+
- name: Archive native package binary
27+
shell: bash
28+
env:
29+
ARCH: ${{ inputs.arch }}
30+
run: tar -cf "ccusage-native-darwin-$ARCH.tar" "packages/ccusage-darwin-$ARCH/bin"
31+
32+
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
33+
with:
34+
name: ccusage-native-darwin-${{ inputs.arch }}
35+
path: ccusage-native-darwin-${{ inputs.arch }}.tar
36+
if-no-files-found: error
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Build Windows native package
2+
description: Build, stage, archive, and upload a Windows ccusage native package
3+
inputs:
4+
arch:
5+
description: Native package architecture
6+
required: true
7+
binary:
8+
description: Path to the built ccusage binary
9+
required: true
10+
runs:
11+
using: composite
12+
steps:
13+
- uses: ./.github/actions/setup-native-build-cache
14+
with:
15+
platform: win32
16+
17+
- name: Build Cargo native binary
18+
shell: bash
19+
run: cargo build --manifest-path rust/Cargo.toml --release --bin ccusage
20+
21+
- name: Stage native package
22+
shell: bash
23+
env:
24+
ARCH: ${{ inputs.arch }}
25+
BINARY: ${{ inputs.binary }}
26+
run: node apps/ccusage/scripts/stage-native-package.mjs --platform win32 --arch "$ARCH" --binary "$BINARY"
27+
28+
- name: Archive native package binary
29+
shell: bash
30+
env:
31+
ARCH: ${{ inputs.arch }}
32+
run: tar -cf "ccusage-native-win32-$ARCH.tar" "packages/ccusage-win32-$ARCH/bin"
33+
34+
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
35+
with:
36+
name: ccusage-native-win32-${{ inputs.arch }}
37+
path: ccusage-native-win32-${{ inputs.arch }}.tar
38+
if-no-files-found: error
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Setup Linux Blacksmith sticky disk
2+
description: Mount Blacksmith sticky disks for Linux Nix and root node_modules caches
3+
runs:
4+
using: composite
5+
steps:
6+
- name: Detect Blacksmith sticky disk support
7+
id: blacksmith
8+
shell: bash
9+
run: |
10+
if [ -n "${BLACKSMITH_STICKYDISK_TOKEN:-}" ]; then
11+
echo "enabled=true" >> "$GITHUB_OUTPUT"
12+
else
13+
echo "enabled=false" >> "$GITHUB_OUTPUT"
14+
fi
15+
16+
- name: Resolve pnpm version
17+
id: pnpm
18+
if: steps.blacksmith.outputs.enabled == 'true'
19+
shell: bash
20+
run: |
21+
package_manager="$(node -p "require('./package.json').packageManager ?? ''")"
22+
case "$package_manager" in
23+
pnpm@*) echo "version=${package_manager#pnpm@}" >> "$GITHUB_OUTPUT" ;;
24+
*) echo "version=unknown" >> "$GITHUB_OUTPUT" ;;
25+
esac
26+
27+
- name: Prepare Nix store mount point
28+
if: steps.blacksmith.outputs.enabled == 'true'
29+
shell: bash
30+
run: |
31+
sudo mkdir -p /nix/store
32+
sudo chmod 755 /nix
33+
34+
- name: Mount Nix store sticky disk
35+
if: steps.blacksmith.outputs.enabled == 'true'
36+
uses: useblacksmith/stickydisk@d58829ad6f9be8822ec5efe74256c82cd62915ab # v1
37+
with:
38+
key: ${{ github.repository }}-nix-${{ runner.os }}-${{ runner.arch }}
39+
path: /nix
40+
41+
- name: Prepare mounted Nix store ownership
42+
if: steps.blacksmith.outputs.enabled == 'true'
43+
shell: bash
44+
run: |
45+
sudo mkdir -p /nix/store
46+
sudo chown "$USER:$(id -gn)" /nix /nix/store
47+
for path in /nix/var/log/nix /nix/var/nix; do
48+
if [ -e "$path" ]; then
49+
sudo chown -R "$USER:$(id -gn)" "$path"
50+
fi
51+
done
52+
53+
- name: Mount root node_modules sticky disk
54+
if: steps.blacksmith.outputs.enabled == 'true'
55+
uses: useblacksmith/stickydisk@d58829ad6f9be8822ec5efe74256c82cd62915ab # v1
56+
with:
57+
key: ${{ github.repository }}-node-modules-pnpm-${{ steps.pnpm.outputs.version }}-${{ runner.os }}-${{ runner.arch }}
58+
path: ./node_modules
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: Setup macOS Nix cache
2+
description: Restore and save the macOS Nix store with the original Nix cache action
3+
runs:
4+
using: composite
5+
steps:
6+
- name: Cache macOS Nix store
7+
uses: nix-community/cache-nix-action@7df957e333c1e5da7721f60227dbba6d06080569 # v7.0.2
8+
with:
9+
primary-key: nix-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('flake.lock', 'flake.nix', 'dev/flake.lock', 'dev/flake.nix', 'default.nix', 'package.nix', 'package.json', 'nix/**/*.nix', 'rust-toolchain.toml', 'rust/Cargo.lock', 'rust/**/Cargo.toml') }}
10+
restore-prefixes-first-match: nix-${{ runner.os }}-${{ runner.arch }}-
11+
gc-max-store-size-macos: 3500000000
12+
purge: true
13+
purge-prefixes: nix-${{ runner.os }}-${{ runner.arch }}-
14+
purge-created: 172800
15+
purge-primary-key: never
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Setup native build cache
2+
description: Restore native package build caches for the current platform
3+
inputs:
4+
platform:
5+
description: Native package platform
6+
required: true
7+
runs:
8+
using: composite
9+
steps:
10+
- name: Cache Cargo build
11+
if: inputs.platform == 'win32'
12+
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
13+
with:
14+
path: |
15+
~/.cargo/registry
16+
~/.cargo/git
17+
rust/target
18+
key: cargo-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('rust/Cargo.lock', 'rust-toolchain.toml') }}-${{ github.run_id }}-${{ github.run_attempt }}
19+
restore-keys: |
20+
cargo-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('rust/Cargo.lock', 'rust-toolchain.toml') }}-
21+
cargo-${{ runner.os }}-${{ runner.arch }}-

‎.github/actions/setup-nix/action.yaml‎

Lines changed: 6 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,24 @@
11
name: Setup Nix
2-
description: Install Nix and restore the Nix store from the GitHub Actions cache
2+
description: Install Nix with platform-specific cache setup
33
inputs:
4-
cache-profile:
5-
description: Which Nix cache key scope to use
6-
default: package
74
warm-dev-shell:
85
description: Whether to instantiate the CI dev shell during setup
96
default: 'false'
107
runs:
118
using: composite
129
steps:
10+
- uses: ./.github/actions/setup-linux-blacksmith-sticky-disk
11+
if: runner.os == 'Linux'
12+
1313
- name: Install Nix
1414
uses: nixbuild/nix-quick-install-action@2c9db80fb984ceb1bcaa77cdda3fdf8cfba92035 # v34
1515
with:
1616
github_access_token: ${{ github.token }}
1717
nix_conf: |
1818
access-tokens = github.com=${{ github.token }}
1919
20-
- name: Cache Nix store for package builds
21-
if: inputs.cache-profile == 'package'
22-
uses: nix-community/cache-nix-action@7df957e333c1e5da7721f60227dbba6d06080569 # v7.0.2
23-
with:
24-
# Package jobs should not rotate when only development tooling changes.
25-
primary-key: nix-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('flake.lock', 'flake.nix', 'default.nix', 'package.nix', 'package.json', 'nix/**/*.nix', 'rust-toolchain.toml', 'rust/Cargo.lock', 'rust/**/Cargo.toml') }}
26-
restore-prefixes-first-match: nix-${{ runner.os }}-${{ runner.arch }}-
27-
gc-max-store-size-linux: 3500000000
28-
purge: true
29-
purge-prefixes: nix-${{ runner.os }}-${{ runner.arch }}-
30-
purge-created: 172800
31-
purge-primary-key: never
32-
33-
- name: Cache Nix store for development jobs
34-
if: inputs.cache-profile == 'dev'
35-
uses: nix-community/cache-nix-action@7df957e333c1e5da7721f60227dbba6d06080569 # v7.0.2
36-
with:
37-
# Development jobs include the separate dev flake and its tooling lock.
38-
primary-key: nix-dev-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('flake.lock', 'flake.nix', 'dev/flake.lock', 'dev/flake.nix', 'default.nix', 'package.nix', 'package.json', 'nix/**/*.nix', 'rust-toolchain.toml', 'rust/Cargo.lock', 'rust/**/Cargo.toml') }}
39-
restore-prefixes-first-match: nix-dev-${{ runner.os }}-${{ runner.arch }}-
40-
gc-max-store-size-linux: 3500000000
41-
purge: true
42-
purge-prefixes: nix-dev-${{ runner.os }}-${{ runner.arch }}-
43-
purge-created: 172800
44-
purge-primary-key: never
20+
- uses: ./.github/actions/setup-macos-nix-cache
21+
if: runner.os == 'macOS'
4522

4623
- name: Fix single-user Nix store ownership
4724
if: runner.os != 'Windows'

‎.github/workflows/cache-gc.yaml‎

Lines changed: 21 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,30 @@
1-
name: Cache GC
1+
name: Sticky Disk GC
22

33
on:
44
schedule:
5-
# Weekly on Sunday 03:00 UTC.
65
- cron: '0 3 * * 0'
76
workflow_dispatch:
87

9-
permissions: {}
8+
permissions: read-all
109

1110
jobs:
12-
gc:
13-
name: Garbage-collect old Actions caches
14-
runs-on: ubuntu-slim
15-
permissions:
16-
actions: write
11+
nix-store-gc:
12+
name: Nix store GC (${{ matrix.name }})
13+
runs-on: ${{ matrix.runner }}
14+
timeout-minutes: 20
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
include:
19+
- name: linux-arm64
20+
runner: blacksmith-32vcpu-ubuntu-2404-arm
21+
- name: linux-x64
22+
runner: blacksmith-32vcpu-ubuntu-2404
23+
1724
steps:
18-
- name: Delete caches not accessed in the last 14 days
19-
env:
20-
GH_TOKEN: ${{ github.token }}
21-
GH_REPO: ${{ github.repository }}
22-
shell: bash
23-
run: |
24-
# The per-run `purge` in setup-nix only trims superseded keys created
25-
# by CI. This sweep also reclaims caches left behind by merged or
26-
# abandoned branches that no longer trigger CI.
27-
cutoff=$(date -u -d '14 days ago' +%s)
28-
# Sort least-recently-accessed first so the stalest caches are the
29-
# ones fetched under --limit; the default order is descending and
30-
# would fetch the freshest caches instead, never reaching old ones.
31-
gh cache list --limit 100 --sort last_accessed_at --order asc --json id,key,lastAccessedAt \
32-
--jq '.[] | [.id, .lastAccessedAt, .key] | @tsv' \
33-
| while IFS=$'\t' read -r id last key; do
34-
last_epoch=$(date -u -d "$last" +%s)
35-
if [ "$last_epoch" -lt "$cutoff" ]; then
36-
echo "Deleting stale cache: $key (last accessed $last)"
37-
gh cache delete "$id"
38-
fi
39-
done
25+
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
26+
with:
27+
persist-credentials: false
28+
- uses: ./.github/actions/setup-nix
29+
- name: Delete Nix store paths older than 7 days
30+
run: nix-collect-garbage --delete-older-than 7d

0 commit comments

Comments
 (0)