DEV Community

Cover image for Migrating Azure Devops Activity to GitHub 🔄️
Ramy Gamal
Ramy Gamal

Posted on

Migrating Azure Devops Activity to GitHub 🔄️

GitHub isn’t just a place to store code anymore. For many developers, it’s a living portfolio, a snapshot of what they’re building, exploring, and learning.

Though, my GitHub profile didn’t reflect that at all. This happened when I joined a company that don't use GitHub for managing the codebase.

Most of my day-to-day work happens in a private codebase hosted on Azure DevOps. So even though I’m actively coding, shipping, and solving problems, my GitHub looked… inactive. Almost like I stopped coding altogether.

The Idea

One night, I decided to fix this.

Since I genuinely enjoy building automation scripts, I thought:
Why not automatically sync my activity from azure DevOps into my GitHub account?

So I built a small script that:

  1. Pulls my commits from Azure DevOps (where I’m the author)
  2. Replays them into a private GitHub repository
  3. Runs automatically on a daily schedule

How It Works

The setup is pretty straightforward:

  • Uses Azure DevOps APIs to fetch commits
  • Filters commits by author
  • Pushes them into GitHub as new commits (A private repository is recommended to contain your activity)
  • Runs daily using GitHub Actions.

Now, my GitHub profile reflects actual activity again without changing how or where I work. 😁

The script was originally built for my own use, but it is open-source in case it’s useful to others.

If you’re working across different platforms and want a unified presence, this might help or at least spark an idea.

👉 Check it out:

GitHub logo Raamyy / azuredevops-commits-migrator

Bring your Azure Devops contribution history into Github!

Azure DevOps to GitHub Migration Tool

Github profile is so boring when no activity is there when you work at a company that use Azure Devops.

This project helps users automate the migration of commits and Pull Requests (PRs) from an Azure DevOps repository to a GitHub repository. It uses a GitHub workflow to automate the migration process.

Getting Started

  1. Fork this repository
    Click the Fork button in the top-right corner of this page to fork the master repository.

  2. Go to forked repo in your repository

  3. Add secrets:
    settings -> Actions secrets and variables -> Repository secrets -> New repository secrets alt text

    PAT  # Your Azure PAT, you'll know how to get it below
    USER_EMAIL  # Your GITHUB user email
    
    USER_NAME # Your GITHUB user name
    
    AZURE_NAME  # YOUR username on Azure
    
    # Set this number to 1, unless you want to fetch all the previous history
    DAYS_LOOKUP
    
    # This is
    Enter fullscreen mode Exit fullscreen mode

Main function

async function main() {
  if(AZURE_NAME == "") {
    console.error("AZURE_NAME is not set. Please add it to the github secrets with your Azure username. exiting...");
    return;
  }
  let COMMITS = [];
  let projects = await getProjects();
  for (let project of projects) {
    let repositories = await getRepositories(project);
    for (let repo of repositories) {
      let commits = await getCommits(project, repo.name, AZURE_NAME, repo.defaultBranch);
      COMMITS = COMMITS.concat(commits);
    }
  }
  COMMITS = COMMITS.sort(function (a, b) {
    return new Date(a.creationDate) - new Date(b.creationDate);
  });
  console.log(`got toal of ${COMMITS.length} commits`);
  generateGitCommits(COMMITS)
}
Enter fullscreen mode Exit fullscreen mode

If you’re interested in extending it or making it more generic, contributions are welcome. And if you have questions, feel free to reach out.

Now I joined a bit bigger company that still I am not sure of it's policies regarding similar, so my GitHub is back dead again 😭

Do you care about the activity graph, or do you prefer to keep work and personal strictly separate?"

Top comments (0)