-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Fix tag handling: preserve annotations and explicit fetch-tags #2356
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
f12cf15 to
a70240b
Compare
a70240b to
849c4d7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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. |
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