Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions .github/workflows/upgrade-release-tools.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,6 @@ jobs:
version: latest-known
python-version: "3.15"
enable-cache: false
- name: 📅 Check cutoff exception expiry
uses: $/check-nab-exceptions
- name: 🔒 Refresh release lock
id: lock
uses: $/refresh-release-lock
Expand All @@ -83,6 +81,9 @@ jobs:
additional-matrix-implementations: ${{ inputs.additional-matrix-implementations }}
exclude-newer: ${{ inputs.exclude-newer }}
exclude-newer-package: ${{ inputs.exclude-newer-package }}
drop-redundant-exceptions: true
- name: 📅 Check cutoff exception expiry
uses: $/check-nab-exceptions
- name: 📤 Upload maintenance patch
id: upload
uses: actions/upload-artifact@v7.0.2
Expand All @@ -103,6 +104,8 @@ jobs:
artifact-id: ${{ needs.generate-lock.outputs.artifact-id }}
allowed-paths: |
pylock.toml
pyproject.toml
nab.toml
${{ inputs.additional-lock }}
branch: automation/update-release-tools
title: ${{ inputs.pull-request-title }}
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,10 @@
- `upgrade-release-tools.yaml` checks cutoff exceptions before it refreshes the lock. A scheduled run now fails on an
expired or undated exception and names the package, even when no release input changed
([#46](https://github.com/tox-dev/github-workflows/pull/46)) by [@gaborbernat](https://github.com/gaborbernat).
- `upgrade-release-tools.yaml` no longer takes `commit-message`; the pull request title is the commit subject. Remove
the input from callers: GitHub refuses to start a run that still passes it, with
`Invalid input, commit-message is not defined in the referenced workflow`
([#46](https://github.com/tox-dev/github-workflows/pull/46)) by [@gaborbernat](https://github.com/gaborbernat).

<a name="release-6-4-0"></a>

Expand Down
4 changes: 4 additions & 0 deletions changelog.d/+drop-redundant-exceptions.bugfix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
`upgrade-release-tools.yaml` no longer fails on an expired cutoff exception that its own refresh makes redundant: it
deletes that exception in the refresh pull request, keeps the refreshed lock's `created-at`, and then fails only on an
undated exception or an expired one the new lock still needs. `refresh-release-lock` gains `drop-redundant-exceptions`
for this.
2 changes: 2 additions & 0 deletions changelog.d/+exception-expiry-guidance.doc.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Explain that a cutoff exception stays needed until a refresh re-anchors the lock, how to pick its expiry date, and how
to fix the `Invalid input, commit-message is not defined in the referenced workflow` startup failure.
44 changes: 30 additions & 14 deletions docs/locked-tools.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ A `[tool.nab]` exception that admits one package past the cutoff, `packages.<nam
expiry date in a comment directly above the package table header or dotted key:

```toml
# expires 2026-11-09
# expires 2026-11-17
[tool.nab.packages.release-creator]
uploaded-prior-to = 2026-11-02T21:45:00Z
```
Expand All @@ -63,10 +63,18 @@ exception is valid. The check fails when an exception has no such comment, a mal
and names the package. A standalone `nab.toml` is checked the same way. An exception in `[[tool.nab.package-rules]]` is
rejected, since the check does not read those tables; move it to a package table.

Pick a date that outlives the next weekly refresh and the merge of its pull request. A relative cutoff such as `P7D`
counts from the committed lock's `created-at`, not from today, so the exception stays needed while the lock keeps its
anchor, however old the package gets. Only a refresh moves the anchor. Take the upload date, add the cutoff, move to the
next scheduled `upgrade-release-tools` run, and add a week to merge its pull request. For the example above, a
2026-11-02 upload under `P7D` with a Tuesday schedule is first admitted by the 2026-11-10 refresh, so the comment says
2026-11-17. That refresh deletes the exception itself, so you do not have to.

The check runs in three places:

- `upgrade-release-tools.yaml`, before it refreshes the lock. Every caller's scheduled run therefore fails on an expired
or undated exception, even when no release input changed.
- `upgrade-release-tools.yaml`, after the refresh has dropped the exceptions the refreshed lock no longer needs. A
scheduled run fails on an undated exception, or an expired one the new anchor still needs, even when no release input
changed.

- `refresh-release-lock` in `check` mode, which `validate-news` calls when a pull request changes `pyproject.toml`,
`pylock.toml`, a root `pylock.*.toml`, or `nab.toml`.
Expand Down Expand Up @@ -166,6 +174,13 @@ token.
- `mode: refresh` (default) installs the newest Nab under the cutoff, upgrades the full primary lock and the optional
secondary lock, and writes `$RUNNER_TEMP/maintenance.patch` if a lock changes. A lock whose only change is Nab's
`created-at` stamp is restored and produces no patch.
- With `drop-redundant-exceptions: true` in refresh mode, it first deletes each `packages.<name>.uploaded-prior-to`
exception in `pyproject.toml` and `nab.toml` that the refreshed lock no longer needs: one dated at or before the
project's cutoff counted from now. The exception goes with the comment block directly above it, or only the value and
its `# expires` line when the package table holds other settings. An exception with a date but no time admits that
whole day, and one without a time zone, a relative exception, a cutoff other than `P<n>D` or a date, and an inline
table are left alone. The patch then also holds the changed file, and the lock keeps its new `created-at`, since
without the exception only that anchor keeps the pinned releases under the cutoff.
- `mode: check` first runs [`check-nab-exceptions`](#expire-cutoff-exceptions), then regenerates the locks without
upgrading and fails if anything other than Nab's recorded command line differs. The committed lock must carry a valid
`created-at` that is not in the future. Check mode installs the Nab version that the committed `pylock.toml` records
Expand All @@ -174,17 +189,18 @@ token.

Every Nab run unsets `SSL_CERT_FILE` and `SSL_CERT_DIR`, so Nab uses its own certificate store.

| Input | Default | Purpose |
| ----------------------------------- | ----------------- | ---------------------------------------------------------------- |
| `mode` | `refresh` | `refresh` or `check`. |
| `additional-lock` | empty | Basename of a secondary Nab lock for a separate build matrix. |
| `additional-lock-groups` | empty | Groups for the secondary lock; empty selects build requirements. |
| `additional-lock-selection` | `build-or-groups` | `project` selects the project's runtime dependencies instead. |
| `additional-matrix-python` | empty | Python range for the secondary lock. |
| `additional-matrix-platforms` | empty | Space-separated Nab platform IDs. |
| `additional-matrix-implementations` | empty | Space-separated Python implementations. |
| `exclude-newer` | `7 days` | Cutoff for Nab in refresh mode and the other tools. |
| `exclude-newer-package` | empty | Newline-separated `name=date` overrides. |
| Input | Default | Purpose |
| ----------------------------------- | ----------------- | ---------------------------------------------------------------------- |
| `mode` | `refresh` | `refresh` or `check`. |
| `drop-redundant-exceptions` | `false` | In refresh mode, delete exceptions the refreshed lock no longer needs. |
| `additional-lock` | empty | Basename of a secondary Nab lock for a separate build matrix. |
| `additional-lock-groups` | empty | Groups for the secondary lock; empty selects build requirements. |
| `additional-lock-selection` | `build-or-groups` | `project` selects the project's runtime dependencies instead. |
| `additional-matrix-python` | empty | Python range for the secondary lock. |
| `additional-matrix-platforms` | empty | Space-separated Nab platform IDs. |
| `additional-matrix-implementations` | empty | Space-separated Python implementations. |
| `exclude-newer` | `7 days` | Cutoff for Nab in refresh mode and the other tools. |
| `exclude-newer-package` | empty | Newline-separated `name=date` overrides. |

Output `changed`: `true` only when refresh produces a patch. The resulting pull request's normal formatting job runs
prek, and the writer checks patch paths and modes.
19 changes: 11 additions & 8 deletions docs/maintenance.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,17 @@ All three need the same setup:

## Refresh the release lock: `upgrade-release-tools.yaml`

The read-only job first runs [`check-nab-exceptions`](locked-tools.md#expire-cutoff-exceptions), so every scheduled run
fails on an expired or undated cutoff exception even when no release input changed. It then runs
[`refresh-release-lock`](locked-tools.md#refresh-release-lock) in `refresh` mode, which rebuilds the universal
`pylock.toml` with `nab lock --all-groups --all-extras --no-cache --upgrade`: runtime dependencies, all extras, and all
dependency groups. The project's `[tool.nab]` table sets the cutoff and any per-package exception; the caller adds and
removes those exceptions itself. uv only installs tools and never resolves the lock.

When the lock changes, the job uploads a patch that may change only `pylock.toml` and the configured secondary lock.
The read-only job runs [`refresh-release-lock`](locked-tools.md#refresh-release-lock) in `refresh` mode with
`drop-redundant-exceptions: true`. It deletes the cutoff exceptions that a lock anchored now no longer needs, then
rebuilds the universal `pylock.toml` with `nab lock --all-groups --all-extras --no-cache --upgrade`: runtime
dependencies, all extras, and all dependency groups. The project's `[tool.nab]` table sets the cutoff and any
per-package exception; the caller adds them, and the refresh removes them once they are redundant. uv only installs
tools and never resolves the lock. The job then runs [`check-nab-exceptions`](locked-tools.md#expire-cutoff-exceptions)
on what is left, so a scheduled run fails on an undated exception or an expired one the refreshed lock still needs, even
when no release input changed. An expired exception the refresh makes redundant no longer blocks that refresh.

When the lock changes, the job uploads a patch that may change only `pylock.toml`, the configured secondary lock, and
the `pyproject.toml` or `nab.toml` exceptions it dropped.
[`open-maintenance-pr`](#open-a-maintenance-pull-request-open-maintenance-pryaml) checks it before minting the App token
and opens or updates one pull request from `automation/update-release-tools` to `main`, labelled `dependencies` and
`skip news`. Create both labels and allow the App to push that branch.
Expand Down
18 changes: 15 additions & 3 deletions docs/troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,16 @@
Errors the shared workflows and Actions report, keyed by the text in the job log. Search this page for a phrase from the
`Error:` annotation.

## Any shared workflow

**`Invalid input, <name> is not defined in the referenced workflow`**

The run ends in `startup_failure` with no jobs and no logs; the message shows only on the run's page, under
`Invalid workflow file`. The caller passes an input the pinned release of the shared workflow does not declare, usually
after bumping the pin past a release that removed it. `upgrade-release-tools.yaml` dropped `commit-message` in 6.5.0,
since the pull request title is the commit subject: delete the `commit-message:` line from the caller's `with:` block.
For any other input, compare the caller's `with:` keys with the `workflow_call` inputs of the release it pins.

## Any writer job

**A dispatched check workflow prepared a real release.** The dry-run input was derived from `github.event_name`. A
Expand All @@ -29,9 +39,11 @@ An `allow-skipped` entry of `required-checks` is not a job ID in the gate's `nee

**`... uploaded-prior-to exception needs a '# expires YYYY-MM-DD' comment directly above it`**

A `[tool.nab]` cutoff exception has passed its date or has none. Delete the exception once the package is a week old, or
add or extend the `# expires` comment. See [Expire cutoff exceptions](locked-tools.md#expire-cutoff-exceptions).
Scheduled `upgrade-release-tools` runs fail on this even when nothing else changed.
A `[tool.nab]` cutoff exception has passed its date or has none. Add or extend the `# expires` comment. A package being
a week old is not enough to delete the exception: the relative cutoff counts from the committed lock's `created-at`, so
the exception stays needed until a refresh re-anchors the lock, and `upgrade-release-tools` drops it in that refresh's
pull request. See [Expire cutoff exceptions](locked-tools.md#expire-cutoff-exceptions). Scheduled
`upgrade-release-tools` runs fail on an expired exception that the refreshed lock still needs.

**`check mode needs the Nab version in pylock.toml [tool.nab] nab-version`**

Expand Down
21 changes: 20 additions & 1 deletion refresh-release-lock/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ inputs:
mode:
description: Refresh the lock or check that the committed lock is current
default: refresh
drop-redundant-exceptions:
description: In refresh mode, delete the cutoff exceptions the refreshed lock no longer needs
default: "false"
exclude-newer:
description: Upload cutoff for the tools this Action installs from PyPI
default: 7 days
Expand All @@ -38,6 +41,16 @@ runs:
- name: 📅 Check cutoff exception expiry
if: inputs.mode == 'check'
uses: $/check-nab-exceptions
- name: ✂️ Drop cutoff exceptions the refresh no longer needs
id: drop
if: inputs.mode == 'refresh' && inputs.drop-redundant-exceptions == 'true'
shell: bash
run: |
set -euo pipefail
files=(pyproject.toml)
if [[ -f nab.toml ]]; then files+=(nab.toml); fi
changed=$(python3 "$GITHUB_ACTION_PATH/../tools/drop_nab_exceptions.py" "${files[@]}")
echo "files=${changed//$'\n'/ }" >>"$GITHUB_OUTPUT"
- name: 📦 Install Nab
shell: bash
env:
Expand Down Expand Up @@ -154,6 +167,7 @@ runs:
env:
MODE: ${{ inputs.mode }}
ADDITIONAL_LOCK: ${{ inputs.additional-lock }}
DROPPED: ${{ steps.drop.outputs.files }}
run: |
set -euo pipefail
paths=(pylock.toml)
Expand All @@ -162,7 +176,12 @@ runs:
else
echo 'Secondary lock skipped: additional-lock input is empty'
fi
if [[ "$MODE" != check ]]; then
read -ra dropped_files <<<"$DROPPED"
if ((${#dropped_files[@]})); then
# Without the exceptions, only the refreshed created-at keeps the pinned releases under the cutoff.
echo "Lock created-at kept: ${dropped_files[*]} dropped cutoff exceptions"
paths+=("${dropped_files[@]}")
elif [[ "$MODE" != check ]]; then
for lock in "${paths[@]}"; do
git diff --quiet -- "$lock" && continue
# Nab stamps created-at on every run; a lock that differs only there carries no dependency change.
Expand Down
2 changes: 2 additions & 0 deletions tests/bash32_arrays/test_empty_arrays.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ def test_unguarded_array_expansions_are_provably_non_empty() -> None:
("prepare-towncrier/action.yml", "args"): "set to three options before the call",
("publish-github-release/action.yml", "request"): "starts with two -f pairs",
("publish-post-release-pr/action.yml", "paths"): "checked non-empty before any other use",
("refresh-release-lock/action.yml", "dropped_files"): "used only inside the non-empty check",
("refresh-release-lock/action.yml", "files"): "starts with pyproject.toml",
("refresh-release-lock/action.yml", "paths"): "starts with pylock.toml",
("refresh-release-lock/action.yml", "requirements"): "set to one requirement in every mode",
("refresh-release-lock/action.yml", "selected_groups"): "used only inside the non-empty check",
Expand Down
Loading
Loading