-
Notifications
You must be signed in to change notification settings - Fork 0
#194 - Add support for short v1 tag #197
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
#194 - Add support for short v1 tag #197
Conversation
- Add new workflow for automated update of v1 tag. Update will be done after release.
Caution Review failedThe pull request is closed. WalkthroughAdds a GitHub Actions workflow that runs on release published events, resolves the release tag’s commit SHA, creates or force-updates a lightweight Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor GitHub as GitHub Release
participant GA as GitHub Actions
participant Git as Git CLI
participant Origin as remote: origin
GitHub->>GA: release published (tag)
GA->>GA: actions/checkout (full history)
GA->>Git: git config user.name/email (github-actions)
GA->>Git: git fetch --tags --force
GA->>Git: resolve release tag -> commit SHA
alt commit found
GA->>Git: git tag -f v1 <SHA>
GA->>Origin: git push --force-with-lease origin refs/tags/v1
Note right of GA: v1 now points to release commit
else tag not found or unreachable
GA->>GitHub: fail job with error
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
Actionable comments posted: 2
🧹 Nitpick comments (1)
.github/workflows/update_v1_tag.yml (1)
13-15
: Ensure full history for tag/commit resolution.Fetch the full history to reliably resolve the release tag’s commit.
- - name: Checkout repo - uses: actions/checkout@v4 + - name: Checkout repo + uses: actions/checkout@v4 + with: + fetch-depth: 0
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
.github/workflows/update_v1_tag.yml
(1 hunks)
🧰 Additional context used
🪛 actionlint (1.7.7)
.github/workflows/update_v1_tag.yml
5-5: expected "inputs" key for "workflow_dispatch" section but got "types"
(syntax-check)
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.
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.
Actionable comments posted: 0
🧹 Nitpick comments (1)
.github/workflows/update_v1_tag.yml (1)
34-35
: Use--force-with-lease
when pushing the tag.
git push origin -f refs/tags/v1
can overwrite a newer remote tag if someone updates it between fetch and push. Add a lease so the push only proceeds when the remote still matches what we fetched.- git push origin -f refs/tags/v1 + git push origin --force-with-lease=refs/tags/v1 refs/tags/v1
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.
.github/workflows/update_v1_tag.yml
Outdated
git tag -f v1 "$COMMIT_SHA" | ||
git push origin --force-with-lease=refs/tags/v1 refs/tags/v1 |
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.
Fix tag push: --force-with-lease
fails for tags without explicit expectation.
After retagging, git push origin --force-with-lease=refs/tags/v1 refs/tags/v1
has no remote-tracking ref for refs/tags/v1
, so the push aborts once the tag already exists—meaning the workflow can never update v1
. Capture the current remote tag SHA before retagging and pass it as the expected value (or fall back to --force
when the tag is new).
- git tag -f v1 "$COMMIT_SHA"
- git push origin --force-with-lease=refs/tags/v1 refs/tags/v1
+ PREV_SHA="$(git show-ref --tags -s v1 || true)"
+ git tag -f v1 "$COMMIT_SHA"
+ if [ -n "$PREV_SHA" ]; then
+ git push origin --force-with-lease=refs/tags/v1:$PREV_SHA refs/tags/v1
+ else
+ git push origin --force refs/tags/v1
+ fi
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
git tag -f v1 "$COMMIT_SHA" | |
git push origin --force-with-lease=refs/tags/v1 refs/tags/v1 | |
PREV_SHA="$(git show-ref --tags -s v1 || true)" | |
git tag -f v1 "$COMMIT_SHA" | |
if [ -n "$PREV_SHA" ]; then | |
git push origin --force-with-lease=refs/tags/v1:$PREV_SHA refs/tags/v1 | |
else | |
git push origin --force refs/tags/v1 | |
fi |
🤖 Prompt for AI Agents
In .github/workflows/update_v1_tag.yml around lines 34-35, the push uses
--force-with-lease without an expected value which fails when there's no
remote-tracking ref; first query the current remote tag SHA (e.g. git ls-remote
--tags origin refs/tags/v1) and store it as expected_sha, then after retagging
use git push origin --force-with-lease=refs/tags/v1:<expected_sha> refs/tags/v1;
if no remote SHA was found (tag is new) fall back to git push origin --force
refs/tags/v1.
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.
I will return to tested origin.
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.
@miroslavpojer, understood! Feel free to reach out if you need any assistance with the implementation or would like me to review the updated approach. 🐰
Release Notes:
Summary by CodeRabbit
Fixes #194