A web application that helps developers keep their GitHub contribution graph updated, even for work done on branches other than main. The app automatically tracks commits from all repositories and mirrors them to a dedicated code-tracking repository. This ensures that every commit contributes to the user's contribution graph ("green dots") on GitHub.
-
GitHub Authentication:
- Users can sign in via GitHub using
next-auth(Auth.js).
- Users can sign in via GitHub using
-
Automatic Repository Creation:
- Creates a private
code-trackingrepository in the user's GitHub account to centralize commit tracking.
- Creates a private
-
Webhook Setup:
- Automatically sets up webhooks for all repositories in the user's GitHub account.
- Listens for
pushevents from all branches.
-
Commit Mirroring:
- Mirrors commit messages from any branch (other than
main) to thecode-trackingrepository. - Commit messages follow the format:
[repo-name] user-commit-message.
- Mirrors commit messages from any branch (other than
-
GitHub Contribution Graph Update:
- Ensures that every mirrored commit updates the user's contribution graph, even for work done outside the
mainbranch.
- Ensures that every mirrored commit updates the user's contribution graph, even for work done outside the
-
Centralized Activity Log:
- The
code-trackingrepository serves as a log of all coding activity across multiple repositories.
- The
- Next.js (App Router): Framework for building the web app.
- Auth.js (NextAuth): For GitHub authentication.
- Webhooks: To listen to GitHub
pushevents. - Drizzle ORM: Lightweight and type-safe ORM for database management (if applicable for advanced features like user settings).
- Tailwind CSS: For styling the user interface.
- Octokit: For interacting with the GitHub API.
- Ngrok: For testing webhooks in a local development environment.
- Users authenticate via GitHub OAuth using
next-auth. - Upon successful login:
- The app retrieves an
accessTokenfrom GitHub. - This token is stored in the user's session for making API calls.
- The app retrieves an
- Users click the "Create Tracking Repo" button on the dashboard.
- The app calls the
create-repoAPI route:- Checks if a
code-trackingrepository already exists. - If it doesn’t exist, the app creates a new private repository named
code-tracking.
- Checks if a
- Users click the "Create Webhooks" button on the dashboard.
- The app calls the
create-webhookAPI route:- Fetches all repositories owned by the user.
- For each repository, sets up a webhook that listens for
pushevents. - The webhook is configured to send event data to the app's
handle-webhookAPI route.
- When a user commits to any branch other than
mainin their repositories:- GitHub triggers the webhook.
- The webhook sends the commit data to the
handle-webhookAPI route. - The app processes the event and:
- Formats the commit message as
[repo-name] user-commit-message. - Pushes this commit to the
mainbranch of thecode-trackingrepository.
- Formats the commit message as
- Each commit pushed to the
mainbranch of thecode-trackingrepository is recognized by GitHub. - This ensures the user's GitHub contribution graph remains updated with "green dots" for every commit.
-
Clone the repository:
git clone https://github.com/akhil683/Commit-Hub.git cd Commit-Hub -
Install dependencies:
npm install
-
Create a
.env.localfile and add the following environment variables:AUTH_GITHUB_ID=your_github_client_id AUTH_GITHUB_SECRET=your_github_client_secret NEXTAUTH_SECRET=your_nextauth_secret WEBHOOK_URL=your_webhook_url GITHUB_PERSONAL_ACCESS_TOKEN=your_personal_access_token ENCRYPT_KEY=your_encryption_key
-
Run the development server:
npm run dev
-
Open the app in your browser:
http://localhost:3000 -
Use Ngrok to test webhooks locally:
- Install Ngrok:
npm install -g ngrok
- Start an Ngrok tunnel:
ngrok http 3000
- Copy the Ngrok URL and use it to configure webhook URLs in GitHub.
- Install Ngrok:
- Sign In with GitHub: Log in to start using the app.
- Create Tracking Repo: Create the
code-trackingrepository in your GitHub account. - Create Webhooks: Add webhooks to all repositories in your GitHub account.
- View Contribution Graph: Automatically updated with your activity across all repositories.
- Deploy the app on Vercel or any other platform.
- Set the environment variables in the production environment.
- Update the GitHub OAuth application settings to use the deployed URL as the callback.
-
Consistent Contribution Graph:
- Tracks coding activity across all branches and repositories.
- Ensures your GitHub profile accurately reflects your work.
-
Centralized Activity Log:
- Easily view your progress and contributions in one place.
-
Easy to Use:
- Simple dashboard with automated repository and webhook setup.
- Add a dashboard to display commit history directly from the
code-trackingrepository. - Provide user settings for excluding specific repositories.
- Add support for other version control platforms like GitLab or Bitbucket.
Contributions are welcome! Please open an issue or submit a pull request if you'd like to improve the app.
This project is licensed under the MIT License. See the LICENSE file for details.
