gr2m / migrate-greenkeeper-to-dependabot-cli

CLI to migrate all repositories for a given owner
ISC License
1 stars 0 forks source link
dependabot greenkeeper

Migrate Greenkeeper to Dependabot

CLI to migrate all repositories for a given owner

Background

Greenkeeper was acquired and will stop working after June 3rd.

If you plan to migrate your repositories to GitHub's own Dependabot, then this CLI is for you.

There are a few trade-offs to consider

Usage

Create a personal access token at https://github.com/settings/tokens/new?scopes=repo

GITHUB_TOKEN=... npx migrate-greenkeeper-to-dependabot --owner octokit

What it does

I've made this script for my specific needs. If you have different needs, I suggest you fork it, I'm not sure if it's worth sending pull requests for a one-of CLI, but do what yuo think is best :)

  1. Looks for all repositories for the provided owner
  2. In each repository it looks for a Greenkeeper badge. If it doesn't find one, the repository is ignored.
  3. For each remaining repository, it creates a pull request with the following changes

    1. It removes the Greenkeeper badge

    2. It updates Action workflow files. It looks for the on.push.branches array. If it finds any string starting with greenkeeper/..., it replaces it with dependabot/npm_and_yarn/...

    3. It creates a .github/dependabot.yml file with the following configuration

      version: 2
      updates:
      - package-ecosystem: "npm"
        directory: "/"
        schedule:
          interval: "daily"
        labels:
          - "maintenance"
    4. It adds a "maintenance" label on the pull request

LICENSE

ISC