Why a moved tag escapes every other check#
Review policy acts on pull requests, and CI acts on commits. A tag is neither. It is a name that points at a commit, and anyone with write access can repoint it with two commands. No pull request opens and no diff is shown, so nobody is asked to look.
This local demonstration uses a throwaway repository and a bare origin on disk, so it shows Git's behavior, not GitHub's. A maintainer tags a release and pushes it, a consumer clones, and the maintainer then moves the tag to a commit nobody reviewed. Lines naming the local remote and Git's error: failed to push some refs line are left out:
$ git tag v1.0.0 && git push origin v1.0.0
* [new tag] v1.0.0 -> v1.0.0
(consumer) $ git rev-parse --short v1.0.0
08d30cf
$ git tag -f v1.0.0
Updated tag 'v1.0.0' (was 08d30cf)
$ git push origin v1.0.0
! [rejected] v1.0.0 -> v1.0.0 (already exists)
hint: Updates were rejected because the tag already exists in the remote.
$ git push --force origin v1.0.0
+ 08d30cf...c0bd84f v1.0.0 -> v1.0.0 (forced update)
(fresh clone) $ git rev-parse --short v1.0.0
c0bd84f
(consumer) $ git fetch --tags
! [rejected] v1.0.0 -> v1.0.0 (would clobber existing tag)
(consumer) $ git rev-parse --short v1.0.0
08d30cf
Git refuses the plain push, and --force overrides it. Afterward the two clones disagree about what v1.0.0 is. The consumer who fetched before the move keeps 08d30cf, because git fetch will not overwrite an existing tag, while anyone cloning from now on gets c0bd84f. Two people can build "1.0.0" from different code and both be right about what their tag says. Deleting a tag and pushing a new one with the same name produces the same split.
What a tag ruleset does#
GitHub's tag protection rules no longer exist. GitHub announced their sunset in May 2024 and said that on 30 August 2024 "All tag protection rules will be migrated to a new tag ruleset." GitHub changelog, 29 May 2024 Tags are now protected with rulesets: in the repository's Settings, open Rulesets, click New ruleset, then New tag ruleset. Creating rulesets for a repository
Four rules matter for release tags. Their definitions in Available rules for rulesets apply to branches and tags alike:
| Rule | Documented effect on matching tags |
|---|---|
| Restrict creations | "only users with bypass permissions can create" them |
| Restrict updates | "only users with bypass permissions can push to" them |
| Restrict deletions | "only users with bypass permissions can delete" them; selected by default |
| Block force pushes | prevents "users from force pushing to the targeted branches or tags"; enabled by default |
With updates and force pushes restricted, the git push --force origin v1.0.0 above is rejected for everyone not on the bypass list. With deletions restricted, the delete-and-recreate route fails too.
Suppose a fictional repository, acme/payments-api, publishes releases from a release workflow that runs as a GitHub App. As the REST API accepts it, the ruleset is:
{
"name": "release tags: created by release app only",
"target": "tag",
"enforcement": "active",
"bypass_actors": [
{ "actor_id": 1100231, "actor_type": "Integration", "bypass_mode": "always" }
],
"conditions": {
"ref_name": { "include": ["refs/tags/v*"], "exclude": [] }
},
"rules": [
{ "type": "creation" },
{ "type": "update" },
{ "type": "deletion" },
{ "type": "non_fast_forward" }
]
}
The actor ID is made up; use your release app's. GitHub matches patterns with fnmatch using the File::FNM_PATHNAME flag, so * does not cross a /. v* covers v1.0.0 and v2.3.1-rc.1, but not a namespaced tag such as v1/hotfix. If your tags contain slashes, use a pattern with **. Using fnmatch syntax
The cost#
Restricting updates and deletions costs almost nothing in ordinary work, since nobody should be moving a published release tag. The cost shows up on a bad release day, when a maintainer wants to retag v1.0.0 onto a fixed commit. The ruleset says no, and the right answer is to publish v1.0.1, which leaves v1.0.0 meaning what it meant to everyone who already fetched it.
Restrict creations costs more. Every person who cuts a release by hand must be on the bypass list or go through the release app. If your releases are manual, either name the release managers as a team on the bypass list or leave creations unrestricted and rely on updates and deletions. Keep the bypass list short either way, as the bypass list guide describes, because a bypass actor can still move a tag.
What a tag ruleset does not catch#
The ruleset controls who can create, move or delete a matching tag. It does not check what the tag points at. A bypass actor, or anyone at all if creations are unrestricted, can create v1.0.1 on a commit that never passed review or never reached main. To tie tags to reviewed code, have the release workflow create the tag only from a commit on the protected branch, and protect that branch against rewrites as the force push guide describes.
It also covers only names that match. A tag named release-1.0.0, or V1.0.0 if your consumers accept it, falls outside v*. And it says nothing about tag signatures: Require signed commits checks commits, and the documentation does not describe a ruleset rule for signed tags.
The decision#
If anyone consumes your tags, add a tag ruleset with updates, deletions and force pushes restricted, today. It has almost no friction and closes a gap no reviewer can see. Add Restrict creations when releases come from automation, and put that automation alone on the bypass list. When a release is wrong, publish a new version instead of moving the old tag.