Skip to content

Commit ff4aa04

Browse files
authored
docs(anvil): document the action pinning policy (#128)
1 parent bc6abcc commit ff4aa04

2 files changed

Lines changed: 36 additions & 1 deletion

File tree

.anvil.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
version = 1
22
tool = "anvil"
3-
tool_version = "0.5.0"
3+
tool_version = "0.6.0"
44
catalog_checksum = "sha256:7e4e7f7fa0e7f9491d3f5123f80ef209261e71b9cd9039e2f388e4287dc2f6bc"
55

66
[[file]]

crates/cargo-anvil/docs/design/github.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -901,6 +901,41 @@ Recommended root workflow shape:
901901
- All cargo-tool installs done by the catalog setup recipes use `--locked` (with
902902
`cargo install` or `cargo binstall` depending on `installer`).
903903

904+
### Action pinning
905+
906+
Third-party actions are pinned in one of two ways, and the split is deliberate rather
907+
than inconsistent.
908+
909+
Actions whose publisher has enabled GitHub [immutable releases][immutable] are pinned
910+
by tag. In the generated workflows that is, at the time of writing,
911+
`codecov/codecov-action@v7.0.0`, `marocchino/sticky-pull-request-comment@v3.0.5` and
912+
`cargo-bins/cargo-binstall@v1.21.0`; a repository's own hand-maintained workflows apply
913+
the same rule to the actions they use, so the list a reader sees there may be longer.
914+
An immutable release locks its Git tag to one commit: the tag cannot be moved, and
915+
cannot be deleted while the release exists. The tag name cannot be reused even after
916+
the repository is deleted and recreated, and publishing generates a release
917+
attestation covering the tag, commit SHA and assets. The tag is a stable identifier
918+
under those rules, and unlike a SHA it stays readable in the diff when the pin is
919+
bumped. Generated files carry a
920+
`# immutable release, the tag cannot be moved` comment at each such pin, so the reason
921+
a tag appears where a SHA is otherwise expected is visible at the use site.
922+
923+
Every other action is pinned by commit SHA with the version in a trailing comment, for
924+
example `actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1`.
925+
926+
Immutability is a property of one published release, not a standing guarantee about
927+
the publisher. When bumping a tag-pinned action, confirm the new release still reports
928+
it:
929+
930+
```console
931+
$ gh api repos/codecov/codecov-action/releases/tags/v7.0.0 --jq .immutable
932+
true
933+
```
934+
935+
If that returns `false`, or the release is missing, pin the commit SHA instead.
936+
937+
[immutable]: https://docs.github.com/en/code-security/concepts/supply-chain-security/immutable-releases
938+
904939
## 10. Coverage upload
905940

906941
After `pr-test` (and `scheduled-test`) runs the `anvil-llvm-cov` recipe, the reusable

0 commit comments

Comments
 (0)