Skip to content

Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows

ci(nightly): trigger from a `nightly` PR label (#2645)

Maximilian Roos6ad763051a26
diff --git a/.github/workflows/nightly.yaml b/.github/workflows/nightly.yaml
index ac92cb0f5..c2f33bb4e 100644
--- a/.github/workflows/nightly.yaml
+++ b/.github/workflows/nightly.yaml
@@ -8,9 +8,12 @@ name: nightly
# - minimal-versions: cargo check against minimum-version dep resolution
# - nix-flake: nix flake check (packaging-environment bugs, motivated by #2624)
#
-# Runs daily on cron, on demand via workflow_dispatch, and on pushes/PRs that
-# touch dependency or toolchain files — catching cargo-affecting changes at
-# PR time avoids a 24-hour bisect window. The cron run still catches drift
+# Runs daily on cron, on demand via workflow_dispatch, on pushes to main that
+# touch dependency or toolchain files, and on PRs that either (a) touch the
+# same dependency/toolchain files or (b) carry the `nightly` label. The
+# label is the iteration knob for fixes targeting nightly-only failures
+# (e.g. nix-flake's sandbox suite); without it, contributors had to wait for
+# the cron run or `gh workflow run` manually. The cron still catches drift
# that's not commit-correlated (registry updates, transitive resolution).
#
# Runner versions pinned; see ci.yaml header comment for rationale.
@@ -24,17 +27,17 @@ on:
push:
branches: [main]
paths:
- - 'Cargo.toml'
+ - '**/Cargo.toml'
- 'Cargo.lock'
- 'rust-toolchain.toml'
- '.github/workflows/nightly.yaml'
pull_request:
branches: [main]
- paths:
- - 'Cargo.toml'
- - 'Cargo.lock'
- - 'rust-toolchain.toml'
- - '.github/workflows/nightly.yaml'
+ # `labeled` fires when a label is added (so the `nightly` label can
+ # trigger a run mid-PR); `synchronize` re-runs on subsequent pushes.
+ # The `gate` job below decides whether to actually run, ORing the
+ # label against a Cargo-paths diff check.
+ types: [opened, synchronize, reopened, labeled]
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
@@ -46,6 +49,37 @@ env:
RUSTFLAGS: -C debuginfo=0
jobs:
+ gate:
+ # Decides whether to run on PR events. Non-PR events (cron,
+ # workflow_dispatch, push) pass through unconditionally. PR events
+ # run when either the `nightly` label is attached OR the diff touches
+ # one of the dependency/toolchain files. The decision is exposed via
+ # `outputs.run`; downstream jobs gate on it.
+ #
+ # `dorny/paths-filter` works against the GitHub API for PR events, so
+ # no checkout step is needed.
+ runs-on: ubuntu-24.04
+ permissions:
+ pull-requests: read
+ outputs:
+ run: ${{ steps.decide.outputs.run }}
+ steps:
+ - uses: dorny/paths-filter@v3
+ if: github.event_name == 'pull_request'
+ id: changes
+ with:
+ filters: |
+ nightly:
+ - '**/Cargo.toml'
+ - 'Cargo.lock'
+ - 'rust-toolchain.toml'
+ - '.github/workflows/nightly.yaml'
+ - id: decide
+ run: |
+ echo "run=${{ github.event_name != 'pull_request' ||
+ contains(github.event.pull_request.labels.*.name, 'nightly') ||
+ steps.changes.outputs.nightly == 'true' }}" >> "$GITHUB_OUTPUT"
+
feature-powerset:
# Every combination of cli/syntax-highlighting/shell-integration-tests/
# git-wt should compile. Catches regressions in feature gating — including
@@ -55,6 +89,8 @@ jobs:
# Workspace members must use `default-features = false` when depending on
# worktrunk, or feature unification will mask gating bugs by silently
# enabling `cli` in the lib build (see tests/helpers/wt-perf/Cargo.toml).
+ needs: gate
+ if: needs.gate.outputs.run == 'true'
runs-on: ubuntu-24.04
steps:
- name: 📂 Checkout code
@@ -85,6 +121,8 @@ jobs:
# PTY tests are intentionally off because they read $SHELL from the
# runner env, which resolves differently on `ubuntu-24.04-arm` and
# masks musl/arm signal with environment noise.
+ needs: gate
+ if: needs.gate.outputs.run == 'true'
strategy:
fail-fast: false
matrix:
@@ -122,6 +160,8 @@ jobs:
# already advisory non-required (CLAUDE.md: "Don't wait for CI
# benchmarks before merging"). The cron run also appends results to the
# time-series gist so we have daily perf history on main.
+ needs: gate
+ if: needs.gate.outputs.run == 'true'
runs-on: ubuntu-24.04
steps:
- name: 📂 Checkout code
@@ -181,6 +221,8 @@ jobs:
# Moved from ci.yaml — `cargo udeps` requires nightly toolchain anyway,
# so it's already in the "nightly concern" bucket; rarely flips between
# PRs touching deps.
+ needs: gate
+ if: needs.gate.outputs.run == 'true'
runs-on: ubuntu-24.04
steps:
- name: 📂 Checkout code
@@ -208,6 +250,8 @@ jobs:
# exists for the same downstream-protection reason) can resolve to a
# lower compatible version that doesn't actually compile if our manifest
# under-specifies.
+ needs: gate
+ if: needs.gate.outputs.run == 'true'
runs-on: ubuntu-24.04
steps:
- name: 📂 Checkout code
@@ -238,6 +282,8 @@ jobs:
# with default features (lib + bins + integration + doctests; the
# `shell-integration-tests` feature is intentionally off). Cold builds
# take ~10-15 min without a binary cache; nightly cadence absorbs it.
+ needs: gate
+ if: needs.gate.outputs.run == 'true'
runs-on: ubuntu-24.04
steps:
- name: 📂 Checkout code