Skip to content

feat: add PR title to pretty version name in ISO name and menu entry#46

Merged
phorcys420 merged 2 commits into
mainfrom
feat/pr-title-in-iso-name
Jun 30, 2026
Merged

feat: add PR title to pretty version name in ISO name and menu entry#46
phorcys420 merged 2 commits into
mainfrom
feat/pr-title-in-iso-name

Conversation

@phorcys420

@phorcys420 phorcys420 commented Jun 30, 2026

Copy link
Copy Markdown
Member

Closes #42.

What

When a build is for a pull request, weave the PR title and number into the image's pretty version name — both the boot-menu label (BIOS/isolinux + EFI/grub) and the ISO file name — so reviewers can tell at a glance which PR an image came from.

How

  • nixos/_images/box-turnkey.nix (shared by all image flavours) is the single source of truth:
    • coderBox.prTitle (from CODER_BOX_PR_TITLE) and coderBox.prNumber (from CODER_BOX_PR_NUMBER). Reading from the env (the build already runs --impure) means an arbitrary title never has to be shell-escaped into a Nix expression; getEnv returns "" in pure eval / when unset, so tag/main/local builds are unaffected.
    • Two derived, read-only fragments so every flavour appends identically:
      • prMenuSuffix" - PR #46: <title>" (number omitted if unknown), with menu-breaking chars (quotes, backslashes, newlines) neutralised.
      • prFileSuffix"-pr-46-<slug>", where <slug> is the lowercased title reduced to [a-z0-9-] (dash runs collapsed, edges trimmed, capped at 40 chars).
  • installer/iso.nix: for a PR build the PR reference comes first and the commit hash moves to the very end of the boot-menu label; non-PR builds keep the plain (<rev>) form.
  • appliance/iso.nix: appends the PR suffix (no rev in its label).
  • .github/workflows/test.yml sets CODER_BOX_PR_TITLE / CODER_BOX_PR_NUMBER from the PR event (job-level env:, forwarded with -e) so the title can't break the shell; empty for non-PR events.
  • Makefile documents the local preview override.

Examples

Installer, PR #46 title fix: the thing! (v2):

  • ISO: coder-box-installer-x86_64-linux-pr-46-fix-the-thing-v2.iso
  • Menu: - Coder Box Installer - PR #46: fix: the thing! (v2) (abc123def456)

No PR (tag/main/local) — unchanged:

  • ISO: coder-box-installer-x86_64-linux.iso
  • Menu: - Coder Box Installer (abc123def456)

Validation

  • nix flake check --impure --no-build --all-systems → all checks passed.
  • Evaluated isoImage.isoName / appendToMenuLabel for installer + appliance, with/without PR title and with/without PR number, confirming the names above.

phorcys420 added a commit that referenced this pull request Jun 30, 2026
Refine the pretty version name for PR preview builds:

- Add `coderBox.prNumber` (the GitHub PR ID), read from CODER_BOX_PR_NUMBER and
  set in CI from github.event.pull_request.number. Woven into the menu label as
  "#46" and the file name as "-46" when present.
- The installer boot-menu label now puts the PR reference first and moves the
  commit hash to the very end when a PR title is present:
    " - Coder Box Installer - PR #46: <title> (<rev>)"
  Non-PR builds are unchanged: " - Coder Box Installer (<rev>)".

Example file name: coder-box-installer-x86_64-linux-pr-46-fix-the-thing.iso
Closes #42.

Weave the pull-request title into each image's "pretty version name" — the
boot-menu label and the ISO file name — when a build is for a PR.

- box-turnkey.nix gains `coderBox.prTitle` (reads CODER_BOX_PR_TITLE under the
  --impure eval every image build already uses, so an arbitrary title never
  needs shell-escaping into a Nix expression; empty in pure eval / when unset).
- Two derived read-only fragments share one append path across flavours:
  prMenuSuffix (" - PR: <title>", menu-breaking chars neutralised) and
  prFileSuffix ("-pr-<slug>", lowercased [a-z0-9-] slug, dash runs collapsed,
  trimmed, capped at 40 chars).
- appliance/iso.nix and installer/iso.nix append these to appendToMenuLabel and
  image.baseName. Empty for tag/main/local builds, so those names are unchanged.
- test.yml sets CODER_BOX_PR_TITLE from github.event.pull_request.title (job-level
  env, forwarded with -e) so the title can't break the shell.
- Makefile documents the local preview override.
Refine the pretty version name for PR preview builds:

- Add `coderBox.prNumber` (the GitHub PR ID), read from CODER_BOX_PR_NUMBER and
  set in CI from github.event.pull_request.number. Woven into the menu label as
  "#46" and the file name as "-46" when present.
- The installer boot-menu label now puts the PR reference first and moves the
  commit hash to the very end when a PR title is present:
    " - Coder Box Installer - PR #46: <title> (<rev>)"
  Non-PR builds are unchanged: " - Coder Box Installer (<rev>)".

Example file name: coder-box-installer-x86_64-linux-pr-46-fix-the-thing.iso
@phorcys420 phorcys420 force-pushed the feat/pr-title-in-iso-name branch from 0aeef32 to 6710500 Compare June 30, 2026 17:13
@phorcys420 phorcys420 merged commit 9b46ca9 into main Jun 30, 2026
6 checks passed
phorcys420 added a commit that referenced this pull request Jul 1, 2026
Split the boot-screen footer across up to two GRUB labels so a long PR
title no longer overflows the screen width:

  line 1 (always):  Coder Box - <short-sha>@<branch>
  line 2 (PR only): (PR #46: <title>)

A non-PR build shows only line 1. box-turnkey.nix now exposes
coderBox.bootLabelLine1 / bootLabelLine2 (replacing the single-line
bootLabel), and base/iso.nix stacks the second label ~1 line-height below
the first (emitted only when line 2 is non-empty).
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.

feat: add PR reference in ISO file name and menu entry

1 participant