Skip to content

ci(workflows): standardize and harden steps - #217

Merged
sheeeng merged 23 commits into
unstablefrom
ci/standardize-workflows
Aug 26, 2026
Merged

sheeeng merged 23 commits into
unstablefrom
ci/standardize-workflows

Conversation

@sheeeng

@sheeeng sheeeng commented Aug 26, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Replace DeterminateSystems/nix-installer-action with
    determinatesystems/determinate-nix-action at v3.22.2.
  • Keep DeterminateSystems/magic-nix-cache-action as a separate
    Setup Nix Cache step after Setup Nix in relevant workflows.
  • Add standard name: fields to all steps across workflow files.
  • Apply checkout hardening with persist-credentials: false.
  • Add format-with-treefmt.yaml as a new formatting workflow that
    runs on all treefmt-managed file types and targets both main and
    unstable branches.
  • Add review-dependency.yaml as a new dependency review workflow
    that runs on pull requests with concurrency control.
  • Expand concurrency block in review-dependency.yaml with
    cancel-in-progress: true.
  • Add push hardening and fix --base unstable in
    update-terraform-binary-version.yaml.

@sheeeng
sheeeng force-pushed the ci/standardize-workflows branch from 223c038 to c9b886a Compare August 26, 2026 19:53
@sheeeng
sheeeng requested a balanced review from Copilot August 26, 2026 19:55

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The formatting workflow misses supported file types and can report unrelated setup failures as formatting errors.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Standardizes and hardens CI workflows while adding dependency and formatting checks.

Changes:

  • Standardizes step names, Nix setup, caching, and checkout security.
  • Adds dependency review and Treefmt workflows.
  • Silences development-shell and direnv output.
File summaries
File Description
.github/workflows/check-nix-flake.yml Standardizes Nix setup and step names.
.github/workflows/format-with-treefmt.yaml Adds automated formatting checks.
.github/workflows/review-dependency.yaml Adds dependency review with concurrency control.
.github/workflows/run-pre-commit-via-determinate.yaml Migrates Determinate Nix setup.
.github/workflows/run-pre-commit-via-nix.yaml Names setup and cache steps.
.github/workflows/show-nix-info.yaml Standardizes Nix installation and reporting.
.github/workflows/switch-nix.yaml Hardens checkout and standardizes Nix steps.
.github/workflows/update-flake-lock.yml Names automation steps.
.github/workflows/update-nix-flake-lock.yml Names lock-update workflow steps.
.github/workflows/update-terraform-binary-version.yaml Hardens Terraform update automation.
.github/workflows/validate-renovate-configuration.yaml Migrates the Renovate validation job.
home-manager/programs/direnv.nix Silences direnv logging.
shell.nix Removes standard-shell startup output and editor export.
Review details
  • Files reviewed: 13/13 changed files
  • Comments generated: 2
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The formatting workflow skips the active unstable branch and its failure explanation cannot run after a failed check.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details

Suppressed comments (3)

Previously missed (2) — in code that hasn't changed since the last review.

shell.nix:62

  • This change removes EDITOR=vim and the standard shell banner, which changes the developer environment but is not included in the stated CI workflow scope. Restore this hook or explicitly include the developer-shell behavior change in the pull request description.
    shellHook = "";

home-manager/programs/direnv.nix:20

  • Enabling silent mode changes interactive direnv output for every user of this Home Manager configuration, but the pull request describes only CI workflow changes. Revert or separate this behavior change, or update the stated scope.
    # https://github.com/direnv/direnv/issues/68#issuecomment-162639262
    silent = true; # https://nix-community.github.io/home-manager/options.xhtml#opt-programs.direnv.silent

.github/workflows/switch-nix.yaml:1

  • Deleting this workflow also removes the only CI invocation of morlana -- switch --flake ., but the pull request description does not mention dropping that validation. Restore the workflow with the standardized actions, or document and justify the loss of switch validation.
  • Files reviewed: 13/13 changed files
  • Comments generated: 3
  • Review effort level: Balanced

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The formatting trigger omits managed YAML files, and several undocumented changes remove CI coverage or alter interactive behavior.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details

Suppressed comments (3)

Previously missed (3) — in code that hasn't changed since the last review.

.github/workflows/switch-nix.yaml:1

  • This removes the only workflow that exercises morlana switch, while the pull request description only calls for standardizing and hardening workflows and does not mention dropping this CI coverage. Restore the workflow with the standardized steps, or explicitly document and justify its removal.
    shell.nix:62
  • This removes the development shell banner and EDITOR=vim behavior, which is unrelated to the stated CI workflow changes. Restore this hook or move and document the user-facing shell change separately.
    shellHook = "";

home-manager/programs/direnv.nix:20

  • Enabling silent direnv output changes interactive Home Manager behavior but is not included in this CI-focused pull request's description. Revert this setting here, or move and document the behavior change separately.
    # https://github.com/direnv/direnv/issues/68#issuecomment-162639262
    silent = true; # https://nix-community.github.io/home-manager/options.xhtml#opt-programs.direnv.silent
  • Files reviewed: 13/13 changed files
  • Comments generated: 1
  • Review effort level: Balanced

Repository owner deleted a comment from Copilot AI Aug 26, 2026
@sheeeng
sheeeng requested a balanced review from Copilot August 26, 2026 20:32

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Formatting triggers can skip managed files, the default shell loses its editor setting, and switch-path CI coverage is removed.

Review details

Suppressed comments (3)

Previously missed (2) — in code that hasn't changed since the last review.

shell.nix:62

  • Replacing the hook also removes the existing EDITOR=vim assignment, so the default standard-shell no longer provides its editor setting while minimal-shell still does. Preserve the setting as a shell attribute if the intent is only to silence the hook output.
    shellHook = "";

.github/workflows/format-with-treefmt.yaml:44

  • Deleting switch-nix.yaml removes the only workflow invocation of morlana switch; this new step validates formatting only, so the switch path no longer has CI coverage. Restore dedicated switch validation or add an equivalent replacement before removing that workflow.
      - name: Check Formatting with Treefmt

.github/workflows/format-with-treefmt.yaml:12

  • These exclusions skip the workflow for changes limited to *.lock.yaml or *.lock.yml, but treefmt.nix excludes them only from Prettier. The keep-sorted formatter still includes *, and the global exclusions do not cover these suffixes, so Treefmt-managed files can bypass this check. Remove these two workflow exclusions or exclude the patterns globally in Treefmt.
      - "!**/*.lock.yaml"
      - "!**/*.lock.yml"
  • Files reviewed: 14/15 changed files
  • Comments generated: 0 new
  • Review effort level: Balanced

Replace `DeterminateSystems/nix-installer-action` with
`determinatesystems/determinate-nix-action` at `v3.22.2`. Keep
`DeterminateSystems/magic-nix-cache-action` as a separate
`Setup Nix Cache` step. Add standard `name:` fields to all
steps across all eleven workflow files. Apply checkout hardening
with `persist-credentials: false`. Expand the `concurrency`
block in `review-dependency.yaml` to include
`cancel-in-progress: true`. Add push hardening and fix
`--base unstable` in `update-terraform-binary-version.yaml`.
Add `format-with-treefmt.yaml` as a new formatting workflow.

Signed-off-by: Leonard Sheng Sheng Lee <[email protected]>
Signed-off-by: Leonard Sheng Sheng Lee <[email protected]>
Signed-off-by: Leonard Sheng Sheng Lee <[email protected]>
Add `*.lock` to prettier's `excludes` list, sorted before
`*.lock.yaml` and `*.lock.yml`.

Signed-off-by: Leonard Sheng Sheng Lee <[email protected]>
Signed-off-by: Leonard Sheng Sheng Lee <[email protected]>
Restore `switch-nix.yaml` and revert the `shell.nix` `shellHook`
change. Both belong in a separate pull request on the
`chore/shell-direnv-cleanup` branch.

Signed-off-by: Leonard Sheng Sheng Lee <[email protected]>
@sheeeng
sheeeng force-pushed the ci/standardize-workflows branch from 2beacf7 to c85fa87 Compare August 26, 2026 20:52
Replace `null` with `""` for `shellHook` in `standard-shell`.
`mkShell` concatenates `shellHook` as a string, so `null` causes
a Nix evaluation error: `cannot coerce null to a string`.

Signed-off-by: Leonard Sheng Sheng Lee <[email protected]>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The Switch Nix workflow executes an unpinned upstream flake and misses the stated action and step-name standardization.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details

Suppressed comments (4)

.github/workflows/switch-nix.yaml:40

  • Add a name to this run step to satisfy the PR's stated requirement that all workflow steps have standard name fields.
      - run: |

.github/workflows/switch-nix.yaml:43

  • Add a name to this run step to satisfy the PR's stated requirement that all workflow steps have standard name fields.
      - run: |

.github/workflows/switch-nix.yaml:46

  • Add a name to this run step to satisfy the PR's stated requirement that all workflow steps have standard name fields.
      - run: |

.github/workflows/switch-nix.yaml:49

  • Add a name to this run step to satisfy the PR's stated requirement that all workflow steps have standard name fields.
      - run: |-
  • Files reviewed: 13/14 changed files
  • Comments generated: 4
  • Review effort level: Balanced

Comment thread .github/workflows/switch-nix.yaml Resolved
Comment thread .github/workflows/switch-nix.yaml Resolved
Comment thread .github/workflows/switch-nix.yaml Resolved
Comment thread .github/workflows/switch-nix.yaml Resolved

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The pre-commit version substitutions now print literally, and the unrelated flake upgrades require clarification.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details

Suppressed comments (2)

.github/workflows/run-pre-commit-via-determinate.yaml:90

  • The inner shell receives this single-quoted string, so it prints $(pre-commit --version) literally rather than the version. Use inner double quotes to preserve delayed substitution while allowing the Nix-shell command to run.
            echo 'Pre-Commit Version: \$(pre-commit --version)'

.github/workflows/run-pre-commit-via-nix.yaml:115

  • The inner shell receives this single-quoted string, so it prints $(pre-commit --version) literally rather than the version. Use inner double quotes to preserve delayed substitution while allowing the Nix-shell command to run.
            echo 'Pre-Commit Version: \$(pre-commit --version)'
  • Files reviewed: 12/13 changed files
  • Comments generated: 2
  • Review effort level: Balanced

Change the `echo` commands in `Show Pre-Commit Version` and
`Run Pre-Commit` to use escaped double quotes rather than single
quotes. The inner bash runs inside the nix environment, where
`pre-commit` is available. Single-quoted strings prevent the
`\$(pre-commit ...)` substitution from expanding, so the version
never appears in the output. Escaped double quotes allow the
inner shell to expand the substitution correctly.

Signed-off-by: Leonard Sheng Sheng Lee <[email protected]>
Update job `name:` fields to use Title Case in all workflows,
consistent with Chicago Manual of Style conventions and the
naming convention already used by the pre-commit and treefmt
workflows.

- `check-nix-flake` → `Check Nix Flake`
- `check-nixpkgs-currency` → `Check Nixpkgs Currency`
- `show-nix-info` → `Show Nix Info`
- Add `name: Dependency Review` to `review-dependency.yaml`

Signed-off-by: Leonard Sheng Sheng Lee <[email protected]>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The Nix information workflow risks exposing its token, and formatting push runs cannot cancel superseded executions.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details

Suppressed comments (1)

Previously missed (1) — in code that hasn't changed since the last review.

.github/workflows/format-with-treefmt.yaml:18

  • Using github.sha makes every push run use a different concurrency group, so cancel-in-progress: true cannot cancel an older run after another commit reaches the same branch. Group push runs by the stable ref instead.
  group: "${{ github.workflow }}-${{ github.head_ref || github.sha }}"
  • Files reviewed: 12/13 changed files
  • Comments generated: 1
  • Review effort level: Balanced

Register `github.token` as a masked secret before printing
`/etc/nix/nix.conf` in the `Show Nix Configuration` step.
`determinate-nix-action` writes the token to nix.conf as an
`access-tokens` entry; printing the file would expose it in
the log and job summary.

Two defenses are applied:
- `::add-mask::` registers the token value so GitHub Actions
  replaces it with `***` in all subsequent log output.
- `grep --invert-match "access-tokens"` removes the entry
  from both the log and job summary entirely.

Signed-off-by: Leonard Sheng Sheng Lee <[email protected]>
Replace `github.sha` with `github.ref_name` in all concurrency
group expressions. On push events, `head_ref` is empty, so
`head_ref || sha` resolved to a unique value per commit, making
`cancel-in-progress: true` ineffective. Using `ref_name` groups
runs by branch name on both push and pull request events.

Affected workflows:
- check-nix-flake.yml
- format-with-treefmt.yaml
- run-pre-commit-via-determinate.yaml
- run-pre-commit-via-nix.yaml
- validate-renovate-configuration.yaml

Signed-off-by: Leonard Sheng Sheng Lee <[email protected]>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The undocumented flake dependency upgrades materially expand the stated CI-focused scope.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details
  • Files reviewed: 12/13 changed files
  • Comments generated: 0 new
  • Review effort level: Balanced

Remove unrelated dependency updates from this CI-focused PR.
The changes to `home-manager`, `nixpkgs-darwin-x86_64`, `nur`,
and `stylix` belong in a separate update commit.

Signed-off-by: Leonard Sheng Sheng Lee <[email protected]>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The changes are functionally coherent, with remaining feedback limited to nonblocking style conventions.

Review details

Suppressed comments (2)

Previously missed (2) — in code that hasn't changed since the last review.

.github/workflows/format-with-treefmt.yaml:57

  • Use GNU-style long options as required by the root AGENTS.md. Replace the short sed and tr options with their long equivalents.
          log="$(nix log ".#checks.${system}.formatting" 2>/dev/null | sed -E 's/\x1b\[[0-9;]*[a-zA-Z]//g' | tr -d '\r' || true)"

.github/workflows/show-nix-info.yaml:19

  • Spell out “Information” in this newly updated job name. The root AGENTS.md requires complete terms instead of abbreviations.
    name: Show Nix Info
  • Files reviewed: 12/12 changed files
  • Comments generated: 0 new
  • Review effort level: Balanced

Use GNU-style long options for `sed` and `tr` in
`format-with-treefmt.yaml` as required by `AGENTS.md`.
Replace `sed -E` with `sed --regexp-extended` and `tr -d`
with `tr --delete`.

Spell out "Information" in the `show-nix-info.yaml` workflow
and job names, replacing the abbreviated "Info".

Signed-off-by: Leonard Sheng Sheng Lee <[email protected]>
Signed-off-by: Leonard Sheng Sheng Lee <[email protected]>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The formatting workflow can cancel unrelated pull requests whose source branches share the same name.

Review details

Suppressed comments (1)

Previously missed (1) — in code that hasn't changed since the last review.

.github/workflows/format-with-treefmt.yaml:18

  • Use a pull-request-specific concurrency key. github.head_ref contains only the source branch name, so unrelated pull requests from different forks that both use a common name such as main share this group and cancel each other's formatting runs. github.ref is stable across updates and includes the pull request number for pull request events.
  group: "${{ github.workflow }}-${{ github.head_ref || github.ref_name }}"
  • Files reviewed: 12/12 changed files
  • Comments generated: 0 new
  • Review effort level: Balanced

Replace `github.head_ref || github.ref_name` with `github.ref`
in all concurrency group expressions. `head_ref` holds only the
source branch name, so fork pull requests with identical branch
names (e.g. `main`) share a group and cancel each other's runs.

`github.ref` is unique per pull request (`refs/pull/<n>/merge`)
and per push branch (`refs/heads/<branch>`), eliminating the
cross-fork collision.

Affected workflows:
- check-nix-flake.yml
- format-with-treefmt.yaml
- run-pre-commit-via-determinate.yaml
- run-pre-commit-via-nix.yaml
- show-nix-information.yaml
- validate-renovate-configuration.yaml

Signed-off-by: Leonard Sheng Sheng Lee <[email protected]>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

It changes numerous security-sensitive workflows, including token-bearing write automation and force-push behavior.

Review details
  • Files reviewed: 12/12 changed files
  • Comments generated: 0 new
  • Review effort level: Balanced

@sheeeng
sheeeng merged commit 86547fc into unstable Aug 26, 2026
5 checks passed
@sheeeng
sheeeng deleted the ci/standardize-workflows branch August 26, 2026 22:35
sheeeng added a commit that referenced this pull request Aug 29, 2026
* ci(workflows): standardize and harden steps

Replace `DeterminateSystems/nix-installer-action` with
`determinatesystems/determinate-nix-action` at `v3.22.2`. Keep
`DeterminateSystems/magic-nix-cache-action` as a separate
`Setup Nix Cache` step. Add standard `name:` fields to all
steps across all eleven workflow files. Apply checkout hardening
with `persist-credentials: false`. Expand the `concurrency`
block in `review-dependency.yaml` to include
`cancel-in-progress: true`. Add push hardening and fix
`--base unstable` in `update-terraform-binary-version.yaml`.
Add `format-with-treefmt.yaml` as a new formatting workflow.

Signed-off-by: Leonard Sheng Sheng Lee <[email protected]>

* ci(workflows): fix treefmt trigger and failure step

Signed-off-by: Leonard Sheng Sheng Lee <[email protected]>

* ci(workflows): fix treefmt branches and failure guard

Signed-off-by: Leonard Sheng Sheng Lee <[email protected]>

* ci(workflows): cache pre-commit environments

Signed-off-by: Leonard Sheng Sheng Lee <[email protected]>

* ci(treefmt): exclude lock yaml from prettier

Signed-off-by: Leonard Sheng Sheng Lee <[email protected]>

* ci(treefmt): add lock to prettier excludes

Add `*.lock` to prettier's `excludes` list, sorted before
`*.lock.yaml` and `*.lock.yml`.

Signed-off-by: Leonard Sheng Sheng Lee <[email protected]>

* chore(deps): update flake lock

Signed-off-by: Leonard Sheng Sheng Lee <[email protected]>

* ci(workflows): revert unrelated file changes

Restore `switch-nix.yaml` and revert the `shell.nix` `shellHook`
change. Both belong in a separate pull request on the
`chore/shell-direnv-cleanup` branch.

Signed-off-by: Leonard Sheng Sheng Lee <[email protected]>

* fix(shell): set shell hook to empty string

Replace `null` with `""` for `shellHook` in `standard-shell`.
`mkShell` concatenates `shellHook` as a string, so `null` causes
a Nix evaluation error: `cannot coerce null to a string`.

Signed-off-by: Leonard Sheng Sheng Lee <[email protected]>

* ci(workflows): remove switch-nix workflow

Signed-off-by: Leonard Sheng Sheng Lee <[email protected]>

* ci(treefmt): move lock excludes to global

Move `*.lock.yaml` and `*.lock.yml` from prettier's formatter-level
`excludes` to `settings.global.excludes`. No formatter should process
lock files, so global exclusion is the correct location. Remove the
redundant `*.lock` and `flake.lock` entries from prettier's `excludes`
since `global.excludes` already covers them via `*.lock`.

Signed-off-by: Leonard Sheng Sheng Lee <[email protected]>

* ci(workflows): include nix env in pre-commit key

Add `flake.lock` and `shell.nix` to the `Cache Pre-Commit
Environments` cache key in both pre-commit workflows. Add a
`restore-keys` fallback so a partial cache hit is used when the
exact key misses.

Pre-commit stores environments tied to the Python interpreter path
in the Nix store. A key based only on `.pre-commit-config.yaml`
can restore a stale environment after `flake.lock` or `shell.nix`
changes the interpreter, causing failures instead of a cache miss.

Signed-off-by: Leonard Sheng Sheng Lee <[email protected]>

* ci(workflows): fix command substitution

Escape `$(pre-commit ...)` as `\$(pre-commit ...)` in the
`Show Pre-Commit Version` and `Run Pre-Commit` steps of both
pre-commit workflows.

The `run:` block passes a double-quoted string to `bash -c`.
The outer GitHub Actions shell expands `$(...)` before nix
sets up the environment, causing `pre-commit: command not found`
errors in the log. Escaping the substitution defers evaluation
to the inner bash, which runs inside the nix environment where
`pre-commit` is available.

Signed-off-by: Leonard Sheng Sheng Lee <[email protected]>

* ci(treefmt): add concurrency control

Add the standard concurrency block to `format-with-treefmt.yaml`
to cancel stale runs when a pull request is updated. Every other
workflow in this repository defines the same group pattern:
`${{ github.workflow }}-${{ github.head_ref || github.sha }}`.

Without this, each new push to a pull request leaves a prior
15-minute Nix formatting run active, consuming runners
unnecessarily.

Signed-off-by: Leonard Sheng Sheng Lee <[email protected]>

* chore(deps): update actions/cache to v6.1.0

Update `actions/cache` from `v4.3.0` to `v6.1.0` in both
pre-commit workflows.

Signed-off-by: Leonard Sheng Sheng Lee <[email protected]>

* ci(workflows): fix inner shell substitution

Change the `echo` commands in `Show Pre-Commit Version` and
`Run Pre-Commit` to use escaped double quotes rather than single
quotes. The inner bash runs inside the nix environment, where
`pre-commit` is available. Single-quoted strings prevent the
`\$(pre-commit ...)` substitution from expanding, so the version
never appears in the output. Escaped double quotes allow the
inner shell to expand the substitution correctly.

Signed-off-by: Leonard Sheng Sheng Lee <[email protected]>

* ci(workflows): use title case for job names

Update job `name:` fields to use Title Case in all workflows,
consistent with Chicago Manual of Style conventions and the
naming convention already used by the pre-commit and treefmt
workflows.

- `check-nix-flake` → `Check Nix Flake`
- `check-nixpkgs-currency` → `Check Nixpkgs Currency`
- `show-nix-info` → `Show Nix Info`
- Add `name: Dependency Review` to `review-dependency.yaml`

Signed-off-by: Leonard Sheng Sheng Lee <[email protected]>

* ci(workflows): mask token in nix configuration

Register `github.token` as a masked secret before printing
`/etc/nix/nix.conf` in the `Show Nix Configuration` step.
`determinate-nix-action` writes the token to nix.conf as an
`access-tokens` entry; printing the file would expose it in
the log and job summary.

Two defenses are applied:
- `::add-mask::` registers the token value so GitHub Actions
  replaces it with `***` in all subsequent log output.
- `grep --invert-match "access-tokens"` removes the entry
  from both the log and job summary entirely.

Signed-off-by: Leonard Sheng Sheng Lee <[email protected]>

* ci(workflows): fix concurrency for push events

Replace `github.sha` with `github.ref_name` in all concurrency
group expressions. On push events, `head_ref` is empty, so
`head_ref || sha` resolved to a unique value per commit, making
`cancel-in-progress: true` ineffective. Using `ref_name` groups
runs by branch name on both push and pull request events.

Affected workflows:
- check-nix-flake.yml
- format-with-treefmt.yaml
- run-pre-commit-via-determinate.yaml
- run-pre-commit-via-nix.yaml
- validate-renovate-configuration.yaml

Signed-off-by: Leonard Sheng Sheng Lee <[email protected]>

* chore(flake): restore lock to unstable baseline

Remove unrelated dependency updates from this CI-focused PR.
The changes to `home-manager`, `nixpkgs-darwin-x86_64`, `nur`,
and `stylix` belong in a separate update commit.

Signed-off-by: Leonard Sheng Sheng Lee <[email protected]>

* ci(workflows): apply style conventions

Use GNU-style long options for `sed` and `tr` in
`format-with-treefmt.yaml` as required by `AGENTS.md`.
Replace `sed -E` with `sed --regexp-extended` and `tr -d`
with `tr --delete`.

Spell out "Information" in the `show-nix-info.yaml` workflow
and job names, replacing the abbreviated "Info".

Signed-off-by: Leonard Sheng Sheng Lee <[email protected]>

* ci(workflows): rename to show-nix-information

Signed-off-by: Leonard Sheng Sheng Lee <[email protected]>

* ci(workflows): scope concurrency by github.ref

Replace `github.head_ref || github.ref_name` with `github.ref`
in all concurrency group expressions. `head_ref` holds only the
source branch name, so fork pull requests with identical branch
names (e.g. `main`) share a group and cancel each other's runs.

`github.ref` is unique per pull request (`refs/pull/<n>/merge`)
and per push branch (`refs/heads/<branch>`), eliminating the
cross-fork collision.

Affected workflows:
- check-nix-flake.yml
- format-with-treefmt.yaml
- run-pre-commit-via-determinate.yaml
- run-pre-commit-via-nix.yaml
- show-nix-information.yaml
- validate-renovate-configuration.yaml

Signed-off-by: Leonard Sheng Sheng Lee <[email protected]>

---------

Signed-off-by: Leonard Sheng Sheng Lee <[email protected]>
sheeeng added a commit that referenced this pull request Aug 29, 2026
* ci(workflows): standardize and harden steps

Replace `DeterminateSystems/nix-installer-action` with
`determinatesystems/determinate-nix-action` at `v3.22.2`. Keep
`DeterminateSystems/magic-nix-cache-action` as a separate
`Setup Nix Cache` step. Add standard `name:` fields to all
steps across all eleven workflow files. Apply checkout hardening
with `persist-credentials: false`. Expand the `concurrency`
block in `review-dependency.yaml` to include
`cancel-in-progress: true`. Add push hardening and fix
`--base unstable` in `update-terraform-binary-version.yaml`.
Add `format-with-treefmt.yaml` as a new formatting workflow.

Signed-off-by: Leonard Sheng Sheng Lee <[email protected]>

* ci(workflows): fix treefmt trigger and failure step

Signed-off-by: Leonard Sheng Sheng Lee <[email protected]>

* ci(workflows): fix treefmt branches and failure guard

Signed-off-by: Leonard Sheng Sheng Lee <[email protected]>

* ci(workflows): cache pre-commit environments

Signed-off-by: Leonard Sheng Sheng Lee <[email protected]>

* ci(treefmt): exclude lock yaml from prettier

Signed-off-by: Leonard Sheng Sheng Lee <[email protected]>

* ci(treefmt): add lock to prettier excludes

Add `*.lock` to prettier's `excludes` list, sorted before
`*.lock.yaml` and `*.lock.yml`.

Signed-off-by: Leonard Sheng Sheng Lee <[email protected]>

* chore(deps): update flake lock

Signed-off-by: Leonard Sheng Sheng Lee <[email protected]>

* ci(workflows): revert unrelated file changes

Restore `switch-nix.yaml` and revert the `shell.nix` `shellHook`
change. Both belong in a separate pull request on the
`chore/shell-direnv-cleanup` branch.

Signed-off-by: Leonard Sheng Sheng Lee <[email protected]>

* fix(shell): set shell hook to empty string

Replace `null` with `""` for `shellHook` in `standard-shell`.
`mkShell` concatenates `shellHook` as a string, so `null` causes
a Nix evaluation error: `cannot coerce null to a string`.

Signed-off-by: Leonard Sheng Sheng Lee <[email protected]>

* ci(workflows): remove switch-nix workflow

Signed-off-by: Leonard Sheng Sheng Lee <[email protected]>

* ci(treefmt): move lock excludes to global

Move `*.lock.yaml` and `*.lock.yml` from prettier's formatter-level
`excludes` to `settings.global.excludes`. No formatter should process
lock files, so global exclusion is the correct location. Remove the
redundant `*.lock` and `flake.lock` entries from prettier's `excludes`
since `global.excludes` already covers them via `*.lock`.

Signed-off-by: Leonard Sheng Sheng Lee <[email protected]>

* ci(workflows): include nix env in pre-commit key

Add `flake.lock` and `shell.nix` to the `Cache Pre-Commit
Environments` cache key in both pre-commit workflows. Add a
`restore-keys` fallback so a partial cache hit is used when the
exact key misses.

Pre-commit stores environments tied to the Python interpreter path
in the Nix store. A key based only on `.pre-commit-config.yaml`
can restore a stale environment after `flake.lock` or `shell.nix`
changes the interpreter, causing failures instead of a cache miss.

Signed-off-by: Leonard Sheng Sheng Lee <[email protected]>

* ci(workflows): fix command substitution

Escape `$(pre-commit ...)` as `\$(pre-commit ...)` in the
`Show Pre-Commit Version` and `Run Pre-Commit` steps of both
pre-commit workflows.

The `run:` block passes a double-quoted string to `bash -c`.
The outer GitHub Actions shell expands `$(...)` before nix
sets up the environment, causing `pre-commit: command not found`
errors in the log. Escaping the substitution defers evaluation
to the inner bash, which runs inside the nix environment where
`pre-commit` is available.

Signed-off-by: Leonard Sheng Sheng Lee <[email protected]>

* ci(treefmt): add concurrency control

Add the standard concurrency block to `format-with-treefmt.yaml`
to cancel stale runs when a pull request is updated. Every other
workflow in this repository defines the same group pattern:
`${{ github.workflow }}-${{ github.head_ref || github.sha }}`.

Without this, each new push to a pull request leaves a prior
15-minute Nix formatting run active, consuming runners
unnecessarily.

Signed-off-by: Leonard Sheng Sheng Lee <[email protected]>

* chore(deps): update actions/cache to v6.1.0

Update `actions/cache` from `v4.3.0` to `v6.1.0` in both
pre-commit workflows.

Signed-off-by: Leonard Sheng Sheng Lee <[email protected]>

* ci(workflows): fix inner shell substitution

Change the `echo` commands in `Show Pre-Commit Version` and
`Run Pre-Commit` to use escaped double quotes rather than single
quotes. The inner bash runs inside the nix environment, where
`pre-commit` is available. Single-quoted strings prevent the
`\$(pre-commit ...)` substitution from expanding, so the version
never appears in the output. Escaped double quotes allow the
inner shell to expand the substitution correctly.

Signed-off-by: Leonard Sheng Sheng Lee <[email protected]>

* ci(workflows): use title case for job names

Update job `name:` fields to use Title Case in all workflows,
consistent with Chicago Manual of Style conventions and the
naming convention already used by the pre-commit and treefmt
workflows.

- `check-nix-flake` → `Check Nix Flake`
- `check-nixpkgs-currency` → `Check Nixpkgs Currency`
- `show-nix-info` → `Show Nix Info`
- Add `name: Dependency Review` to `review-dependency.yaml`

Signed-off-by: Leonard Sheng Sheng Lee <[email protected]>

* ci(workflows): mask token in nix configuration

Register `github.token` as a masked secret before printing
`/etc/nix/nix.conf` in the `Show Nix Configuration` step.
`determinate-nix-action` writes the token to nix.conf as an
`access-tokens` entry; printing the file would expose it in
the log and job summary.

Two defenses are applied:
- `::add-mask::` registers the token value so GitHub Actions
  replaces it with `***` in all subsequent log output.
- `grep --invert-match "access-tokens"` removes the entry
  from both the log and job summary entirely.

Signed-off-by: Leonard Sheng Sheng Lee <[email protected]>

* ci(workflows): fix concurrency for push events

Replace `github.sha` with `github.ref_name` in all concurrency
group expressions. On push events, `head_ref` is empty, so
`head_ref || sha` resolved to a unique value per commit, making
`cancel-in-progress: true` ineffective. Using `ref_name` groups
runs by branch name on both push and pull request events.

Affected workflows:
- check-nix-flake.yml
- format-with-treefmt.yaml
- run-pre-commit-via-determinate.yaml
- run-pre-commit-via-nix.yaml
- validate-renovate-configuration.yaml

Signed-off-by: Leonard Sheng Sheng Lee <[email protected]>

* chore(flake): restore lock to unstable baseline

Remove unrelated dependency updates from this CI-focused PR.
The changes to `home-manager`, `nixpkgs-darwin-x86_64`, `nur`,
and `stylix` belong in a separate update commit.

Signed-off-by: Leonard Sheng Sheng Lee <[email protected]>

* ci(workflows): apply style conventions

Use GNU-style long options for `sed` and `tr` in
`format-with-treefmt.yaml` as required by `AGENTS.md`.
Replace `sed -E` with `sed --regexp-extended` and `tr -d`
with `tr --delete`.

Spell out "Information" in the `show-nix-info.yaml` workflow
and job names, replacing the abbreviated "Info".

Signed-off-by: Leonard Sheng Sheng Lee <[email protected]>

* ci(workflows): rename to show-nix-information

Signed-off-by: Leonard Sheng Sheng Lee <[email protected]>

* ci(workflows): scope concurrency by github.ref

Replace `github.head_ref || github.ref_name` with `github.ref`
in all concurrency group expressions. `head_ref` holds only the
source branch name, so fork pull requests with identical branch
names (e.g. `main`) share a group and cancel each other's runs.

`github.ref` is unique per pull request (`refs/pull/<n>/merge`)
and per push branch (`refs/heads/<branch>`), eliminating the
cross-fork collision.

Affected workflows:
- check-nix-flake.yml
- format-with-treefmt.yaml
- run-pre-commit-via-determinate.yaml
- run-pre-commit-via-nix.yaml
- show-nix-information.yaml
- validate-renovate-configuration.yaml

Signed-off-by: Leonard Sheng Sheng Lee <[email protected]>

---------

Signed-off-by: Leonard Sheng Sheng Lee <[email protected]>
sheeeng added a commit that referenced this pull request Sep 10, 2026
* ci(workflows): standardize and harden steps

Replace `DeterminateSystems/nix-installer-action` with
`determinatesystems/determinate-nix-action` at `v3.22.2`. Keep
`DeterminateSystems/magic-nix-cache-action` as a separate
`Setup Nix Cache` step. Add standard `name:` fields to all
steps across all eleven workflow files. Apply checkout hardening
with `persist-credentials: false`. Expand the `concurrency`
block in `review-dependency.yaml` to include
`cancel-in-progress: true`. Add push hardening and fix
`--base unstable` in `update-terraform-binary-version.yaml`.
Add `format-with-treefmt.yaml` as a new formatting workflow.

Signed-off-by: Leonard Sheng Sheng Lee <[email protected]>

* ci(workflows): fix treefmt trigger and failure step

Signed-off-by: Leonard Sheng Sheng Lee <[email protected]>

* ci(workflows): fix treefmt branches and failure guard

Signed-off-by: Leonard Sheng Sheng Lee <[email protected]>

* ci(workflows): cache pre-commit environments

Signed-off-by: Leonard Sheng Sheng Lee <[email protected]>

* ci(treefmt): exclude lock yaml from prettier

Signed-off-by: Leonard Sheng Sheng Lee <[email protected]>

* ci(treefmt): add lock to prettier excludes

Add `*.lock` to prettier's `excludes` list, sorted before
`*.lock.yaml` and `*.lock.yml`.

Signed-off-by: Leonard Sheng Sheng Lee <[email protected]>

* chore(deps): update flake lock

Signed-off-by: Leonard Sheng Sheng Lee <[email protected]>

* ci(workflows): revert unrelated file changes

Restore `switch-nix.yaml` and revert the `shell.nix` `shellHook`
change. Both belong in a separate pull request on the
`chore/shell-direnv-cleanup` branch.

Signed-off-by: Leonard Sheng Sheng Lee <[email protected]>

* fix(shell): set shell hook to empty string

Replace `null` with `""` for `shellHook` in `standard-shell`.
`mkShell` concatenates `shellHook` as a string, so `null` causes
a Nix evaluation error: `cannot coerce null to a string`.

Signed-off-by: Leonard Sheng Sheng Lee <[email protected]>

* ci(workflows): remove switch-nix workflow

Signed-off-by: Leonard Sheng Sheng Lee <[email protected]>

* ci(treefmt): move lock excludes to global

Move `*.lock.yaml` and `*.lock.yml` from prettier's formatter-level
`excludes` to `settings.global.excludes`. No formatter should process
lock files, so global exclusion is the correct location. Remove the
redundant `*.lock` and `flake.lock` entries from prettier's `excludes`
since `global.excludes` already covers them via `*.lock`.

Signed-off-by: Leonard Sheng Sheng Lee <[email protected]>

* ci(workflows): include nix env in pre-commit key

Add `flake.lock` and `shell.nix` to the `Cache Pre-Commit
Environments` cache key in both pre-commit workflows. Add a
`restore-keys` fallback so a partial cache hit is used when the
exact key misses.

Pre-commit stores environments tied to the Python interpreter path
in the Nix store. A key based only on `.pre-commit-config.yaml`
can restore a stale environment after `flake.lock` or `shell.nix`
changes the interpreter, causing failures instead of a cache miss.

Signed-off-by: Leonard Sheng Sheng Lee <[email protected]>

* ci(workflows): fix command substitution

Escape `$(pre-commit ...)` as `\$(pre-commit ...)` in the
`Show Pre-Commit Version` and `Run Pre-Commit` steps of both
pre-commit workflows.

The `run:` block passes a double-quoted string to `bash -c`.
The outer GitHub Actions shell expands `$(...)` before nix
sets up the environment, causing `pre-commit: command not found`
errors in the log. Escaping the substitution defers evaluation
to the inner bash, which runs inside the nix environment where
`pre-commit` is available.

Signed-off-by: Leonard Sheng Sheng Lee <[email protected]>

* ci(treefmt): add concurrency control

Add the standard concurrency block to `format-with-treefmt.yaml`
to cancel stale runs when a pull request is updated. Every other
workflow in this repository defines the same group pattern:
`${{ github.workflow }}-${{ github.head_ref || github.sha }}`.

Without this, each new push to a pull request leaves a prior
15-minute Nix formatting run active, consuming runners
unnecessarily.

Signed-off-by: Leonard Sheng Sheng Lee <[email protected]>

* chore(deps): update actions/cache to v6.1.0

Update `actions/cache` from `v4.3.0` to `v6.1.0` in both
pre-commit workflows.

Signed-off-by: Leonard Sheng Sheng Lee <[email protected]>

* ci(workflows): fix inner shell substitution

Change the `echo` commands in `Show Pre-Commit Version` and
`Run Pre-Commit` to use escaped double quotes rather than single
quotes. The inner bash runs inside the nix environment, where
`pre-commit` is available. Single-quoted strings prevent the
`\$(pre-commit ...)` substitution from expanding, so the version
never appears in the output. Escaped double quotes allow the
inner shell to expand the substitution correctly.

Signed-off-by: Leonard Sheng Sheng Lee <[email protected]>

* ci(workflows): use title case for job names

Update job `name:` fields to use Title Case in all workflows,
consistent with Chicago Manual of Style conventions and the
naming convention already used by the pre-commit and treefmt
workflows.

- `check-nix-flake` → `Check Nix Flake`
- `check-nixpkgs-currency` → `Check Nixpkgs Currency`
- `show-nix-info` → `Show Nix Info`
- Add `name: Dependency Review` to `review-dependency.yaml`

Signed-off-by: Leonard Sheng Sheng Lee <[email protected]>

* ci(workflows): mask token in nix configuration

Register `github.token` as a masked secret before printing
`/etc/nix/nix.conf` in the `Show Nix Configuration` step.
`determinate-nix-action` writes the token to nix.conf as an
`access-tokens` entry; printing the file would expose it in
the log and job summary.

Two defenses are applied:
- `::add-mask::` registers the token value so GitHub Actions
  replaces it with `***` in all subsequent log output.
- `grep --invert-match "access-tokens"` removes the entry
  from both the log and job summary entirely.

Signed-off-by: Leonard Sheng Sheng Lee <[email protected]>

* ci(workflows): fix concurrency for push events

Replace `github.sha` with `github.ref_name` in all concurrency
group expressions. On push events, `head_ref` is empty, so
`head_ref || sha` resolved to a unique value per commit, making
`cancel-in-progress: true` ineffective. Using `ref_name` groups
runs by branch name on both push and pull request events.

Affected workflows:
- check-nix-flake.yml
- format-with-treefmt.yaml
- run-pre-commit-via-determinate.yaml
- run-pre-commit-via-nix.yaml
- validate-renovate-configuration.yaml

Signed-off-by: Leonard Sheng Sheng Lee <[email protected]>

* chore(flake): restore lock to unstable baseline

Remove unrelated dependency updates from this CI-focused PR.
The changes to `home-manager`, `nixpkgs-darwin-x86_64`, `nur`,
and `stylix` belong in a separate update commit.

Signed-off-by: Leonard Sheng Sheng Lee <[email protected]>

* ci(workflows): apply style conventions

Use GNU-style long options for `sed` and `tr` in
`format-with-treefmt.yaml` as required by `AGENTS.md`.
Replace `sed -E` with `sed --regexp-extended` and `tr -d`
with `tr --delete`.

Spell out "Information" in the `show-nix-info.yaml` workflow
and job names, replacing the abbreviated "Info".

Signed-off-by: Leonard Sheng Sheng Lee <[email protected]>

* ci(workflows): rename to show-nix-information

Signed-off-by: Leonard Sheng Sheng Lee <[email protected]>

* ci(workflows): scope concurrency by github.ref

Replace `github.head_ref || github.ref_name` with `github.ref`
in all concurrency group expressions. `head_ref` holds only the
source branch name, so fork pull requests with identical branch
names (e.g. `main`) share a group and cancel each other's runs.

`github.ref` is unique per pull request (`refs/pull/<n>/merge`)
and per push branch (`refs/heads/<branch>`), eliminating the
cross-fork collision.

Affected workflows:
- check-nix-flake.yml
- format-with-treefmt.yaml
- run-pre-commit-via-determinate.yaml
- run-pre-commit-via-nix.yaml
- show-nix-information.yaml
- validate-renovate-configuration.yaml

Signed-off-by: Leonard Sheng Sheng Lee <[email protected]>

---------

Signed-off-by: Leonard Sheng Sheng Lee <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants