-
Notifications
You must be signed in to change notification settings - Fork 32
Fix "stale info" error for git push #7
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
Fetch new remote before push
Reviewer's GuideUpdates the push workflow to authenticate the remote URL, fetch the latest branch state from origin, and then push with force-with-lease to avoid stale information errors. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Example error for this action: Result after fix: |
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.
Hey @ArchieMeng - I've reviewed your changes - here's some feedback:
- Consider capturing the current branch name in a variable to avoid repeating git branch --show-current and improve readability.
- Instead of permanently setting the remote URL, you could pass the token-embedded URL directly to git push (or restore the original URL afterward) to avoid side effects.
Here's what I looked at during the review
- 🟢 General issues: all looks good
- 🟡 Security: 1 issue found
- 🟢 Testing: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Hello, I wrote those code 4 years ago so maybe I don't fully remember them. 😂 As I understand the existing code. It does the rebase regardless upstream changes. Then compare local with "remote origin". If it showed "diverged" text, then push is needed. I don't understand how I think, if there are commits into fork between checkout, rebase and push, it's correct to refuse to push, if that's the cause of the stale error. |
No, the reason is that: rebase-upstream-action/action.yml Line 60 in 592f63f
This line didn't add the url as a remote, and thus in a not fetched status. Which results in making Git thinking that the status of this remote is not clean, might have some commits not fetched, and rejects the push. The push url should be added as a remote and do fetch at least once before push. You can also check this stackoverflow answer.https://stackoverflow.com/questions/56191415/why-is-git-push-force-with-lease-failing-with-rejected-stale-info-even |
How about doing And will the fetch unshadow commit history? (I guess not, because there is an --unshadow option) |
Is there any suggested changes? You can directly edit on my PR to give a suggested change. |
OK, thank you! |
Fetch new remote before push
Summary by Sourcery
Bug Fixes: