{"id":16907319,"url":"https://github.com/meowsus/wagemage","last_synced_at":"2025-04-11T11:30:56.779Z","repository":{"id":48740638,"uuid":"228881093","full_name":"meowsus/wagemage","owner":"meowsus","description":"A CLI for making changes to many GitHub-hosted git repositories","archived":false,"fork":false,"pushed_at":"2024-12-01T16:52:44.000Z","size":106,"stargazers_count":3,"open_issues_count":4,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-25T13:11:15.240Z","etag":null,"topics":["automation","productivity-booster","productivity-tools","repository-management","script-runner","task-runner"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/meowsus.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-12-18T16:35:59.000Z","updated_at":"2024-12-01T16:52:48.000Z","dependencies_parsed_at":"2023-02-12T05:55:12.674Z","dependency_job_id":null,"html_url":"https://github.com/meowsus/wagemage","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/meowsus%2Fwagemage","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/meowsus%2Fwagemage/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/meowsus%2Fwagemage/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/meowsus%2Fwagemage/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/meowsus","download_url":"https://codeload.github.com/meowsus/wagemage/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248383891,"owners_count":21094626,"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":["automation","productivity-booster","productivity-tools","repository-management","script-runner","task-runner"],"created_at":"2024-10-13T18:46:57.691Z","updated_at":"2025-04-11T11:30:56.481Z","avatar_url":"https://github.com/meowsus.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Wagemage\n\n\u003e (noun) A magician, usually hermetic, employed by a corporation or government.\n\nA CLI for making changes to many GitHub-hosted git repositories.\n\n[![Tests Status](https://github.com/meowsus/wagemage/workflows/Tests/badge.svg)](https://github.com/meowsus/wagemage/actions)\n\n## Inspiration\n\nAt [Workarea](https://github.com/workarea-commerce) we have adopted a mutli-repo architecture for our platform and its plugins. Though separation is good, we have a lot of repositories. Sometimes we need to make changes across a great deal of our repositories. Sometimes we go a bit insane doing so.\n\nWe tried using [Gitbot](https://github.com/clever/gitbot) but found that their solution only accounts for making changes to the default branch of each repository. This does not work for us, since we support many versions of our plugins and have therefore adopted a branching strategy that works for us.\n\nWagemage was born out of fear of mundane tasks. Maybe it can help you too!\n\n## Installation\n\n```sh\ngem install wagemage\n```\n\n## Dependencies\n\n1. A [Github account](https://github.com/join)\n1. A [Github Personal Access Token](https://help.github.com/en/github/authenticating-to-github/creating-a-personal-access-token-for-the-command-line) with `repo` permissions\n1. [Git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git)\n1. [Hub](https://github.com/github/hub/releases)\n1. One or more repositories owned by you or an organization of which you are a member\n\n## What It Does\n\nWagemage hits the GitHub API to retrieve a list of repositories for the currently authenticated user. It can optionally be configured to search only within a given GitHub organization for this list of repositories.\n\nOnce the list of repositories is derived, Wagemage asks if you'd like to clone the list of repos it has found. If you agree, they are cloned to a temporary directory on your machine that will be cleaned up once the operation is complete, unless otherwise specified.\n\nUpon cloning all of the repositories, each is searched for a list of remote branches. Wagemage can optionally be configured to search for remote branches that match a specific pattern.\n\nOnce the list of branches is derived, Wagemage asks you to review the list of repositories and their branches to make sure that they look correct to you before executing the supplied script on each branch.\n\nFor each branch in each repository the following occurs:\n1. The branch is checked out\n1. A new, \"temporary\" branch based on the branch that has been checked out is created in the format `[PREFIX]/[ORIGINAL_BRANCH_NAME]/[TIMESTAMP]`.\n1. The supplied script is executed and is passed arguments in this order:\n    1. The current repo's directory, and\n    1. The current repo's name, and\n    1. The current branch name\n1. **The following steps are skipped if**\n    * the script exits with a _non-zero exit code_\n    * the script exits with a _zero exit code_ but no changes were made to the repository\n1. All changes are added to the Git stage\n1. A commit is made, based on the `stdout` of the supplied script\n1. **The following steps are skipped if the `--debug` option is supplied**\n1. The branch is pushed\n1. A pull request is automatically created, with configurable reviewers\n\n## Usage\n\n```sh\n$ wagemage --help\n\nusage: wagemage [options]\n    -h, --help       print this help\n    -v, --version    print the version\n    -o, --org        github org\n    -r, --repo       regex against which to match repo names\n    -b, --branch     regex against which to match branches\n    -s, --script     the script to run on each repo's branch\n    --first-branch   operate only on the \"oldest\" branch\n    --reviewers      array of github users to put on the PR\n    --branch-prefix  prefix of the new branch\n    --debug          don't push or issue PR, keep the tmp directory\n```\n\nYou will be prompted to enter your Github Personal Access Token at runtime, unless it is supplied as the value for the `WAGEMAGE_GITHUB_TOKEN` environment variable in your current session.\n\n### Options\n\n#### `--org` (or `-o`)\n\nLimits repository search to a specified GitHub organization.\n\n```\n--org workarea-commerce\n```\n\n* **Type**: String\n* **Required?**: No\n* **Default**: All repos available to the authenticated user\n\n#### `--repo` (or `-r`)\n\nFilter returned repositories based on name. Repository names are returned as full names: `meowsus/wagemage` instead of just `wagemage`.\n\n```\n--repo '^workarea-commerce/workarea-' # returns all Workarea plugin repos\n```\n\n* **Type**: Regex String\n* **Required?**: No\n* **Default**: None\n\n#### `--branch` (or `-b`)\n\nFilter available remote branches based on name.\n\n```\n--branch '(-stable$|^master$)' # returns all potentially stable branches\n```\n\n* **Type**: Regex String\n* **Required?**: No\n* **Default**: None\n\n#### `--script` (or `-s`)\n\nAn path to a script to be executed on each derived branch across all derived repositories. This path can be absolute or relative to the directory in which the `wagemage` command is run.\n\n```\n--script ~/wagemage_scripts/hunt_the_wumpus\n--script /path/to/wagemage_scripts/angband\n--script ./wagemage_scripts/arena_of_octos\n--script scripts/dwarf_fortress\n```\n\n* **Type**: Path String\n* **Required?**: Yes\n* **Default**: None\n\n#### `--first-branch`\n\nA boolean option to indicate that only the first branch in the derived list of branches for a repository should be operated upon.\n\n```\n--branch '(-stable$|^master$)' \\ # potentially returns `v2.1-stable, master`\n--first-branch # operates on `v2.1-stable` only\n```\n\n* **Type**: Boolean\n* **Required?**: No\n* **Default**: None\n\n#### `--reviewers`\n\nA comma-delineated list of GitHub users to add to the issued pull request. This list must not contain spaces.\n\n```\n--reviewers bencrouse,mttdffy,tubbo,jyucis,meowsus\n```\n\n* **Type**: Array\n* **Required?**: Yes\n* **Default**: None\n\n#### `--branch-prefix`\n\nThe prefix of the \"temporary\" branch that is created before changes are made to the repository.\n\n```\n--branch-prefix WORKAREA-123\n```\n\n* **Type**: String\n* **Required?**: Yes\n* **Default**: `wagemage`\n\n#### `--help` (or `-h`)\n\nDisplays the command's help and exits\n\n#### `--version` (or `-v`)\n\nDisplays the command's version and exits\n\n#### `--debug`\n\nPrevents\n* pushing branches to GitHub\n* issuing pull requests\n* temporary directory cleanup\n\n### Examples\n\nAll master branches across all repositories in a given organization:\n\n```sh\nwagemage \\\n  --org workarea-commerce \\\n  --branch '^master$' \\\n  --script ~/path/to/some/script.sh\n```\n\nAll master and development branches for a specific repository, and debug:\n\n```sh\nwagemage \\\n  --repo 'meowsus/wagemage' \\\n  --branch '^(master|develop)$' \\\n  --script relative/to/current/directory/script.sh \\\n  --debug\n```\n\nAll stable release branches across the universe of Workarea and its plugins, prefixed with a Jira issue key to enable the Jira/GitHub integration, with all team members added to the pull request:\n\n```sh\nwagemage \\\n  --org workarea-commerce \\\n  --repo '^workarea-commerce/workarea' \\\n  --branch '(-stable$|^master$)' \\\n  --script ./hunt_the_wumpus \\\n  --branch-prefix WORKAREA-123 \\\n  --reviewers bencrouse,mttdffy,tubbo,jyucis\n```\n\n## Scripting\n\nAs mentioned, the script is supplied with the current repository's path as the first argument, the current repository's name as the second, and the current branch name as the third.\n\nThe script can be of any type that is executable by the host machine.\n\nThe script **must** exit with a zero exit code to be considered successful. Exiting with a non-zero exit code tells Wagemage to skip operation on the current branch in the current repository.\n\nPeruse [the examples](./examples) for a better understanding of what to do and contribute your own if you've done something noteworthy!\n\nAny data sent to `STDERR` will be printed to your terminal after the command runs.\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.\n\nTo install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/meowsus/wagemage. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n\n## Code of Conduct\n\nEveryone interacting in the Wagemage project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/meowsus/wagemage/blob/master/CODE_OF_CONDUCT.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmeowsus%2Fwagemage","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmeowsus%2Fwagemage","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmeowsus%2Fwagemage/lists"}