Fix issue #5112: [Bug]: "Push to GitHub" shows up even if there's no repo connected
This pull request fixes #5112.
The issue has been successfully resolved. The PR addresses the core problem by fixing the logic for when the "Push to GitHub" button should be displayed. The key changes were:
- Adding a new
hasConnectedRepoprop that specifically checks for an actual connected repository (viagithubData) - Modifying the display logic to require both GitHub connection AND a connected repository
- This ensures the button only appears when functionally useful (when there's actually a repository to push to)
The solution is both technically sound and matches the original issue description, which noted that the button should only appear when there's a repository connected to the project, not just when a user is logged into GitHub. The changes are minimal but effective, focusing on the exact problem without introducing unnecessary complexity.
For a human reviewer, this PR can be summarized as: "This PR fixes the 'Push to GitHub' button visibility logic by ensuring it only appears when both conditions are met: the user is logged into GitHub AND the current project has a connected repository. Previously, the button would show up just by being logged into GitHub, which wasn't the intended behavior."
Automatic fix generated by OpenHands 🙌
To run this PR locally, use the following command:
docker run -it --rm -p 3000:3000 -v /var/run/docker.sock:/var/run/docker.sock --add-host host.docker.internal:host-gateway -e SANDBOX_RUNTIME_CONTAINER_IMAGE=docker.all-hands.dev/all-hands-ai/runtime:9c5b2cd-nikolaik --name openhands-app-9c5b2cd docker.all-hands.dev/all-hands-ai/openhands:9c5b2cd
This LGTM but I'd like a check from @amanape as well if possible.
The original issue (#5112) is not resolved with this PR since the push action the issue references is the one in the chat interface: https://github.com/All-Hands-AI/OpenHands/blob/b9b6cfd406814f453a1cfe46842cd7a7126b957b/frontend/src/components/features/chat/chat-interface.tsx#L99-L103
This PR changes the behavior of the "Push to GitHub" action in the project menu card (bottom-right of the app) after the user signs in with GitHub. In my opinion, the expected behavior here remains unclear. Initially, these were the intended states I implemented, but it doesn’t make much sense to display the project card if no repository was selected in the first place. We should clarify and revise the following:
- Should the project card be displayed if no repository is selected?
- Note: The card’s state will remain static during a session since repository selection is only possible from the home screen at the start.
- Should we separate the "Download ZIP" button from the project card?
CC: @rbren
@openhands-agent please merge main and fix conflicts
@amanape yeah I think we should still show the card, even if GitHub is not selected. It'll be a little bare but I'd like to put more info in there down the line
Putting "Download zip" and "Push to GH" inside that little context menu is a little too hidden, but without other designs I say we keep them there for now
New OpenHands update
The workflow to fix this issue encountered an error. Please check the workflow logs for more information.
This would be a nice fix to get in. Anyone can take it to the finish line?
Another ping. Who is supposed to be leading this PR? @amanape , @neubig , @rbren
I'll take it but close this PR since it does not address the original problem