{"id":27786304,"url":"https://github.com/clever/gitbot","last_synced_at":"2025-04-30T15:59:18.634Z","repository":{"id":29305552,"uuid":"32838744","full_name":"Clever/gitbot","owner":"Clever","description":"programmatically make changes to many git repositories","archived":false,"fork":false,"pushed_at":"2025-04-24T00:17:57.000Z","size":148,"stargazers_count":77,"open_issues_count":2,"forks_count":9,"subscribers_count":67,"default_branch":"master","last_synced_at":"2025-04-24T01:24:18.774Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Makefile","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Clever.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2015-03-25T02:50:09.000Z","updated_at":"2025-04-24T00:18:01.000Z","dependencies_parsed_at":"2024-06-18T23:59:32.585Z","dependency_job_id":"cca3d7b4-1dfb-405b-b87c-eeed80e890c8","html_url":"https://github.com/Clever/gitbot","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Clever%2Fgitbot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Clever%2Fgitbot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Clever%2Fgitbot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Clever%2Fgitbot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Clever","download_url":"https://codeload.github.com/Clever/gitbot/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251737860,"owners_count":21635692,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-04-30T15:59:17.825Z","updated_at":"2025-04-30T15:59:18.617Z","avatar_url":"https://github.com/Clever.png","language":"Makefile","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gitbot\n\ngitbot lets you programmatically make changes to many git repositories.\n\n## Motivation\n\nClever has a service-oriented architecture where each service is its own git repository.\nThis lets us quickly develop changes that are limited to a single service.\nHowever, there are some changes (see examples below) that need to be made across many services.\n`gitbot` takes the pain out of making changes across many repos.\n\n## Usage\n\n`gitbot` takes in one argument: a path to a config file.\nThe config file is YAML of the following form:\n\n```yaml\n# repos is a list of repositories to examine, e.g. \"git@github.com:Clever/gitbot.git\"\n# the format of each value here must be passable to `git clone`\nrepos:\n  - git@github.com:Clever/aviator.git\n# Basepath to prepend temp directories. Not including this option is okay and the program will assume \"\"\nbase_path: \"path/to/prepend/tmpdir\"\n# change_cmds describes the programs that will be invoked on each repo.\n# a change command must conform to the following rules:\n# - it takes in one positional argument: the path to a repo to examine\n# - it either\n#   (a) makes changes to files within the repo, outputs a commit message to stdout, and exits with code 0\n#   (b) exits with a nonzero exit code\nchange_cmds:\n  # command paths can either be absolute paths, or paths relative to the configuration file.\n  - path: \"/path/to/the/program\"\n    args: [\"-a\", \"flag\"]\n# post_cmds is a list of programs to run on each repo if changes have been made.\n# use post_cmds to do things like pushing branches to github, opening PRs, etc.\n# post_cmds are run within the directory where a repository has been cloned.\n# post_cmds are only run if the change command makes a change.\n# post_cmds can assume that the change has been committed to HEAD.\n# post_cmds are run with the same environment variables as `gitbot` itself.\npost_cmds:\n  - path: \"git\"\n    args: [\"push\", \"origin\", \"HEAD:add-something-trivial\"]\n  - path: \"hub\"\n    args: [\"pull-request\", \"-m\", \"Added something trivial\", \"-b\", \"Clever:master\", \"-h\", \"Clever:add-something-trivial\"]\n```\n\n## Tips\n\n* Start small: run on a single repository to start.\n* Start with a single no-op `post_cmd` and run `gitbot` with `GITBOT_LEAVE_TEMPDIRS=1`.\nThis lets you examine the side effects of the change command without any consequences.\n* Use `git diff HEAD^ HEAD` as a `post_cmd` to see the commit that your change generated.\n\n## Note about using `hub`\n\n[hub](https://github.com/github/hub) is very useful as a `post_cmd`, since it lets you open pull requests.\nHowever, it requires some setup.\n\nTo install `hub`, download a tarball from the `hub` [releases](https://github.com/github/hub/releases) page.\nAfter unpacking the tarball, navigate into the unpacked folder and run the `install` script: `sudo ./install`.\nThis will copy the `hub` binary into `/usr/local/bin/`, man pages into `/usr/local/share`, etc.\nYou can verify the installation by running `hub -h` or `man hub`.\n\nIn order for `hub` to work for private GitHub repositories, you will need to create a file `~/.config/hub` that contains a GitHub oauth token:\n\n```\ngithub.com:\n- user: \u003cyour username\u003e\n  oauth_token: \u003cprovision one by visiting https://github.com/settings/applications\u003e\n  protocol: https\n```\n\nYou can verify the setup by attempting to clone a private repository: `hub clone \u003cuser\u003e/\u003cprivate repo\u003e`.\n\n\n## Install\n\n`gitbot` can be downloaded from the [releases](https://github.com/Clever/gitbot/releases) page.\n\n## Example use cases\n\n- update the version of a dependency to a new version\n- run static analysis tools (e.g. linters)\n- add a license/contributing.md to many repos\n- optimize images\n- programmatically change a common configuration file present in many repos\n\n\n## Vendoring\n\nPlease view the [dev-handbook for instructions](https://github.com/Clever/dev-handbook/blob/master/golang/godep.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclever%2Fgitbot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fclever%2Fgitbot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclever%2Fgitbot/lists"}