Next level repository management with Octoherd

Brian Douglas - Mar 1 '21 - - Dev Community

I recently sat down with Gregor, maintainer of the JavaScript flavor of Octokit, to talk about managing multiple repositories as a maintainer. The management of multiple repositories in an organization can become time-consuming and Gregor shared project, Octoherd as a way to script updates across multiple repositories.

GitHub logo octoherd / cli

CLI to run a octoherd scripts on one or multiple repositories

Octoherd CLI

CLI to run a custom script on one or multiple repositories

Usage

Usage: octoherd run -S path/to/script.js [options]
Options:
      --help                      Show help                                            [boolean]
  -S, --octoherd-script           Path to *.js script. Must be an ES Module. [string] [required]
  -T, --octoherd-token            Requires the "public_repo" scope for public repositories, "rep
                                  o" scope for private repositories. Creates an OAuth token if n
                                  ot set.                                               [string]
  -R, --octoherd-repos            One or multiple repositories in the form of 'repo-owner/repo-n
                                  ame'. 'repo-owner/*' will find all repositories for one owner.
                                   '*' will find all repositories the user has access to.
                                  To exclude a repository use '!repo-owner/repo'. Will prompt
                                  for repositories if not set.                           [array]
      --octoherd-cache            Cache responses for debugging. Creates a ./cache folder if fla
                                  g is set. Override by passing custom path             [string]
      --octoherd-debug            Show debug logs                     [boolean] [default: false]
      --octoherd-bypass-confirms  Bypass prompts to confirm mutating requests
                                                                      [boolean] [default: false]
      --octoherd-base-url         When using with GitHub Enterprise Server,

In our example, Gregor manages to updates the branch protection rules for multiple repositories using one script.

git clone https://github.com/octoherd/scripts.git
npx @octoherd/cli \
  --octoherd-token 0123456789012345678901234567890123456789 \
  scripts/sync-branch-protections/script.js \
  "octoherd/*"\
  --template "octoherd/cli"
Enter fullscreen mode Exit fullscreen mode

If you have ideas for scripts that would help you manage common tasks across GitHub repositories that you would like to automate, considering dropping them in the octoherd/scripts issues.

Come along to our Open Source Friday live streams. We go live on the GitHub Twitch Channel most Fridays. Join the Meetup Group to stay up to date and see the topics each week.

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .