Skip to content

Implemented export to GitHub functionality #28

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

abhignakumar
Copy link

Fixes #22

Added export to GitHub functionality similar to Lovable.dev

Video

Key Features

  • Connect any project to GitHub and it automatically creates a new repo and pushes the code.
  • After each follow-up prompts, when new files are created/updated, it again automatically pushes the code changes to that repo.

OAuth App was created so that the users can authorize and gives the permission to create repos and push code changes.

Register OAuth App

Screenshot 2025-03-13 at 7 44 39 PM
  • Replace <BASE_URL> with the actual deployed frontend URL (or) http://localhost:3000 for local testing.
  • After creation, we will get GITHUB_CLIENT_ID and GITHUB_CLIENT_SECRET. Save these in the environment variables files using .env.example file of frontend and primary-backend. We need both of them on the primary-backend and we need only GITHUB_CLIENT_ID in the frontend.

Currently, there is an issue with projects. All projects use the same directory for creating/updating the files. For example, all projects of React type, use /tmp/react-app directory to make changes. Hence, there is not separate directory for a new project. Each project, should be at a unique path. For instance, when a new project is created of Next.js type, the base code of Next.js project should be copied from /tmp/next-app to let's say /app/<projectId>.

When the above issue is fixed, then, when we are pushing the code to GitHub using pushToGitHubFromDockerContainer(...), we have to give the path to that particular project as the third parameter in the function. For now, I am passing /tmp/projectType as the project directory.

This PR also includes some minor changes/fixes in worker and ws-relayer.

@Jatin123lodhi
Copy link

Hi abhignakumar, can we connect.

@abhignakumar
Copy link
Author

Hi abhignakumar, can we connect.

Sure.

@hkirat
Copy link
Contributor

hkirat commented Mar 19, 2025

this is good

git push -u origin main
`;
return new Promise((resolve) => {
exec(`docker exec ${containerName} sh -c '${gitCommands}'`, (err, stdout, stderr) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so eventually user containers are running as a pod on a k8s cluster. This will not with there altho a decent approach to test things locally

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay.
Yeah, as the project code was inside the code-server docker container, I had to implement it, in this way. (And to test locally)

@abhignakumar
Copy link
Author

this is good

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add export to github functionality
3 participants