Fix tag handling: preserve annotations and explicit fetch-tags#2356
Conversation
f12cf15 to
a70240b
Compare
a70240b to
849c4d7
Compare
There was a problem hiding this comment.
Pull request overview
This pull request fixes multiple tag handling issues in the checkout action by changing how tags are fetched and verified.
- Tags are now fetched by reference (not commit hash) to preserve annotations
- The
fetch-tagsoption now properly controls tag fetching via explicit refspecs - Added validation to detect when tags have been moved after workflow trigger (for shallow fetches)
Reviewed changes
Copilot reviewed 7 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/ref-helper.ts | Modified getRefSpec to accept fetchTags parameter and fetch tags by ref instead of commit; updated testRef to use ^{commit} for annotated tag dereferencing |
| src/git-source-provider.ts | Removed fetchTags from fetch options (now in refspec); added tag movement validation for shallow fetches |
| src/git-command-manager.ts | Removed fetchTags option from fetch method; always use --no-tags with explicit tag control via refspecs |
| test/ref-helper.test.ts | Added comprehensive tests for new fetchTags parameter behavior |
| test/git-command-manager.test.ts | Updated tests to reflect new fetch behavior with --no-tags always present |
| test/verify-fetch-tags.sh | New script to verify tags are properly fetched in E2E tests |
| .github/workflows/test.yml | Added E2E test for fetch-tags: true functionality |
| dist/index.js | Compiled changes matching source modifications |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This PR fixes several issues with tag handling in the checkout action: 1. fetch-tags: true now works (fixes #1471) - Tags refspec is now included in getRefSpec() when fetchTags=true - Previously tags were only fetched during a separate fetch that was overwritten by the main fetch 2. Tag checkout preserves annotations (fixes #290) - Tags are fetched via refspec (+refs/tags/*:refs/tags/*) instead of --tags flag - This fetches the actual tag objects, preserving annotations 3. Tag checkout with fetch-tags: true no longer fails (fixes #1467) - When checking out a tag with fetchTags=true, only the wildcard refspec is used (specific tag refspec is redundant) Changes: - src/ref-helper.ts: getRefSpec() now accepts fetchTags parameter and prepends tags refspec when true - src/git-command-manager.ts: fetch() simplified to always use --no-tags, tags are fetched explicitly via refspec - src/git-source-provider.ts: passes fetchTags to getRefSpec() - Added E2E test for fetch-tags option Related #1471, #1467, #290
849c4d7 to
dc12339
Compare
|
@ericsciple This is fixed in v6.0.2 but that is marked as a pre-release. Was that a mistake and, if not, why not mark it as -beta? This is causing action updates tools to skip/flag it, so I wanted to make sure you were aware of that release marker. |
|
@ben-manes thanks! I just now removed the pre-release flag (I had originally planned to remove it sooner). I will watch for issues, then bump the |
This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [actions/checkout](https://github.com/actions/checkout) | action | patch | `v6.0.1` → `v6.0.2` | --- ### Release Notes <details> <summary>actions/checkout (actions/checkout)</summary> ### [`v6.0.2`](https://github.com/actions/checkout/blob/HEAD/CHANGELOG.md#v602) [Compare Source](actions/checkout@v6.0.1...v6.0.2) - Fix tag handling: preserve annotations and explicit fetch-tags by [@​ericsciple](https://github.com/ericsciple) in [#​2356](actions/checkout#2356) </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0Mi44OS4yIiwidXBkYXRlZEluVmVyIjoiNDIuODkuMiIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsidHlwZS9kZXBlbmRlbmNpZXMiXX0=--> Reviewed-on: https://git.tainton.uk/luke/instant-msg-api/pulls/238 Reviewed-by: Luke Tainton <luke@tainton.uk> Co-authored-by: renovate[bot] <renovate-bot@git.tainton.uk> Co-committed-by: renovate[bot] <renovate-bot@git.tainton.uk>
This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [actions/checkout](https://github.com/actions/checkout) | action | patch | `v6.0.1` → `v6.0.2` | --- ### Release Notes <details> <summary>actions/checkout (actions/checkout)</summary> ### [`v6.0.2`](https://github.com/actions/checkout/blob/HEAD/CHANGELOG.md#v602) [Compare Source](actions/checkout@v6.0.1...v6.0.2) - Fix tag handling: preserve annotations and explicit fetch-tags by [@​ericsciple](https://github.com/ericsciple) in [#​2356](actions/checkout#2356) </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0Mi44OS4yIiwidXBkYXRlZEluVmVyIjoiNDIuODkuMiIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsidHlwZS9kZXBlbmRlbmNpZXMiXX0=--> Reviewed-on: https://git.tainton.uk/actions/gha-workflows/pulls/58 Co-authored-by: renovate[bot] <renovate-bot@git.tainton.uk> Co-committed-by: renovate[bot] <renovate-bot@git.tainton.uk>
This change fixes a bug in creating the GitHub release notes for a release of the Keeta Anchor SDK. Prior to this change it would pull the notes from the commit instead of the tag. This change fixes it so that it pull it from the tag instead of the commit. This was caused by a bug: actions/checkout#290 Fixed in v6.0.2: actions/checkout#2356
This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [actions/checkout](https://github.com/actions/checkout) | action | major | `v4` → `v6` | --- ### Release Notes <details> <summary>actions/checkout (actions/checkout)</summary> ### [`v6`](https://github.com/actions/checkout/blob/HEAD/CHANGELOG.md#v602) [Compare Source](actions/checkout@v5...v6) - Fix tag handling: preserve annotations and explicit fetch-tags by [@​ericsciple](https://github.com/ericsciple) in [#​2356](actions/checkout#2356) ### [`v5`](https://github.com/actions/checkout/blob/HEAD/CHANGELOG.md#v501) [Compare Source](actions/checkout@v4...v5) - Port v6 cleanup to v5 by [@​ericsciple](https://github.com/ericsciple) in [#​2301](actions/checkout#2301) </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My43My4yIiwidXBkYXRlZEluVmVyIjoiNDMuNzMuMiIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==--> Reviewed-on: https://forgejo.internal/forgejo_admin/maximus/pulls/1 Co-authored-by: Renovate Bot <renovatebot@forgejo.internal> Co-committed-by: Renovate Bot <renovatebot@forgejo.internal>
This comment has been minimized.
This comment has been minimized.
…to v6 (#6) This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [https://code.forgejo.org/actions/checkout](https://code.forgejo.org/actions/checkout) | action | major | `v4` → `v6` | --- >⚠️ **Warning** > > Some dependencies could not be looked up. Check the [Dependency Dashboard](issues/3) for more information. --- ### Release Notes <details> <summary>actions/checkout (https://code.forgejo.org/actions/checkout)</summary> ### [`v6`](https://code.forgejo.org/actions/checkout/blob/HEAD/CHANGELOG.md#v602) [Compare Source](https://code.forgejo.org/actions/checkout/compare/v5...v6) - Fix tag handling: preserve annotations and explicit fetch-tags by [@​ericsciple](https://github.com/ericsciple) in [#​2356](actions/checkout#2356) ### [`v5`](https://code.forgejo.org/actions/checkout/blob/HEAD/CHANGELOG.md#v501) [Compare Source](https://code.forgejo.org/actions/checkout/compare/v4...v5) - Port v6 cleanup to v5 by [@​ericsciple](https://github.com/ericsciple) in [#​2301](actions/checkout#2301) </details> --- ### Configuration 📅 **Schedule**: Branch creation - "every weekend" (UTC), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My44NC4yIiwidXBkYXRlZEluVmVyIjoiNDMuODQuMiIsInRhcmdldEJyYW5jaCI6Im1hc3RlciIsImxhYmVscyI6WyJtYWpvci11cGRhdGUiLCJuZWVkcy1yZXZpZXciXX0=--> Reviewed-on: https://git.qtekfun.net/God/homelab-2026/pulls/6 Co-authored-by: renovate-bot <qtekfun+renobot@gmail.com> Co-committed-by: renovate-bot <qtekfun+renobot@gmail.com>
This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [actions/checkout](https://github.com/actions/checkout) | action | major | `v4` → `v6` | --- ### Release Notes <details> <summary>actions/checkout (actions/checkout)</summary> ### [`v6`](https://github.com/actions/checkout/blob/HEAD/CHANGELOG.md#v602) [Compare Source](actions/checkout@v5...v6) - Fix tag handling: preserve annotations and explicit fetch-tags by [@​ericsciple](https://github.com/ericsciple) in [#​2356](actions/checkout#2356) ### [`v5`](https://github.com/actions/checkout/blob/HEAD/CHANGELOG.md#v501) [Compare Source](actions/checkout@v4...v5) - Port v6 cleanup to v5 by [@​ericsciple](https://github.com/ericsciple) in [#​2301](actions/checkout#2301) </details> --- ### Configuration 📅 **Schedule**: Branch creation - Between 12:00 AM and 03:59 AM ( * 0-3 * * * ) (UTC), Automerge - Between 12:00 AM and 03:59 AM ( * 0-3 * * * ) (UTC). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My41LjAiLCJ1cGRhdGVkSW5WZXIiOiI0My41LjAiLCJ0YXJnZXRCcmFuY2giOiJuZXh0IiwibGFiZWxzIjpbXX0=--> Reviewed-on: https://codeberg.org/forgejo/docs/pulls/1793 Reviewed-by: Robert Wolff <mahlzahn@posteo.de> Co-authored-by: Renovate Bot <bot@kriese.eu> Co-committed-by: Renovate Bot <bot@kriese.eu>
Summary
Fixes multiple issues with tag handling in the checkout action.
Issues Fixed
1.
fetch-tags: truedoesn't fetch tags (#1471)Previously, when using
fetch-tags: trueon a branch checkout, tags were not actually fetched. Now tags are properly included in the fetch refspec.2. Annotated tags converted to lightweight (#290)
When checking out an annotated tag, the tag annotation was lost because the action fetched by commit hash rather than by tag reference. Now tags are fetched via explicit refspec (
+refs/tags/*:refs/tags/*), which fetches the actual tag objects and preserves annotations.3. Fatal error with tag +
fetch-tags: true(#1467)Checking out a tag with
fetch-tags: truecaused a fatal error due to duplicate refspecs. Now only the wildcard refspec is used (the specific tag is redundant when fetching all tags).Testing
Unit Tests
Added new unit tests.
E2E Tests