{"id":15140374,"url":"https://github.com/s4heid/branch-switcher","last_synced_at":"2025-10-23T17:31:02.535Z","repository":{"id":35766725,"uuid":"191633992","full_name":"s4heid/branch-switcher","owner":"s4heid","description":"a GitHub bot that switches the base branch of pull requests to the preferred branch","archived":false,"fork":false,"pushed_at":"2023-03-04T03:55:05.000Z","size":2021,"stargazers_count":17,"open_issues_count":21,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-30T19:47:35.052Z","etag":null,"topics":["branches","github-app","probot","probot-app","pull-requests","typescript"],"latest_commit_sha":null,"homepage":"https://github.com/apps/branch-switcher","language":"TypeScript","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/s4heid.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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}},"created_at":"2019-06-12T19:41:38.000Z","updated_at":"2024-08-29T12:07:47.000Z","dependencies_parsed_at":"2024-09-16T13:30:36.197Z","dependency_job_id":"f387b5cd-fcaa-4574-860e-2292e96ff7e8","html_url":"https://github.com/s4heid/branch-switcher","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/s4heid%2Fbranch-switcher","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/s4heid%2Fbranch-switcher/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/s4heid%2Fbranch-switcher/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/s4heid%2Fbranch-switcher/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/s4heid","download_url":"https://codeload.github.com/s4heid/branch-switcher/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":237861420,"owners_count":19377988,"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":["branches","github-app","probot","probot-app","pull-requests","typescript"],"created_at":"2024-09-26T08:20:14.993Z","updated_at":"2025-10-23T17:31:02.050Z","avatar_url":"https://github.com/s4heid.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# branch-switcher\n\n[![Build Status](https://travis-ci.org/s4heid/branch-switcher.svg?branch=master)](https://travis-ci.org/s4heid/branch-switcher)\n[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)\n\nA GitHub App built with [Probot](https://github.com/probot/probot) that automatically\nupdates the base ref of a pull request if it has been opened against a non-preferred\nbranch.\n\n\n## How it works\n\nIn projects where the default branch is not master, pull requests are often opened against a wrong branch. Typically, maintainers of the project need to reach out to the authors and ask them to change the base branch as most bigger projects have automated tests configured against the default branch.\n\nThe intent of this GitHub app is to support maintainers by automatically changing the base branch of pull requests to the default branch if applicable. The app listens to a set of [webhooks](https://developer.github.com/v3/activity/events/types/#pullrequestevent):\n\n- `pull_request.opened`,\n- `pull_request.reopened`,\n- `pull_request.edited`,\n- `pull_request.labeled`,\n- `pull_request.unlabeled`,\n\nwhich triggers\n\n- a check whether the base branch of the pull request matches the preferred branch and changes it if applicable,\n- comments on the pull request and informs the author about the changes being made.\n\n![](assets/preview.png)\n\n\n## Installation\n\n1. [Install the GitHub App](https://github.com/apps/branch-switcher) for the intended repositories.\n1. Create a `.github/branch-switcher.yml` file in the root of the intended repositories where\nbranch-switcher has been installed. This configuration file is optional and overrides any of the default\nsettings.\n\n\n## Configuration\n\nThe following properties are currently supported:\n\n * `preferredBranch` *(string)* - name of the preferred branch against which the\n   pull request should be opened. Default: develop.\n * `switchComment` *(string)* - content of the message indicating that the base\n   has been updated to the preferred branch. `{{author}}` can be used as a placeholder\n   which interpolates to the pull request author and `{{preferredBranch}}` analogously.\n * `exclude` *(Array)* - list of all branches and labels that should be ignored.\n   By default, all branches are considered and no labels are excluded.\n   - `branch` *(string)* - name of the branch that should be ignored.\n   - `label` *(string)* - name of the label that should be ignored.\n\n**Example** `.github/branch-switcher.yml`:\n\n```yaml\nexclude:\n- branch: do-nothing\n- branch: dont-touch-*\n- label: ignore-me\nswitchComment: \u003e\n  Hey @{{author}}, the base branch of your pull request has been changed\n  to {{preferredBranch}}. Have a nice day! :wave:\n```\n\nAbove config does not touch the base branch if there is a label `ignore-me` attached\non the pull request and it also does not switch if the base branch is either called\n`do-nothing` or every branch matching the wildcard `dont-touch-*`.\n\n\n## Development\n\n1. Follow the [docs for deployment](https://probot.github.io/docs/deployment) and\nset the following **Permissions \u0026 events** for the GitHub App:\n  - Pull requests - **Read \u0026 Write**\n    - [x] Check the box for **Pull request review comment** events\n  - Repository metadata - **Read-only**\n  - Single File - **Read-only**\n    - Path: `.github/branch-switcher.yml`\n2. Clone the repo:\n  ```sh\n  git clone git@github.com:s4heid/branch-switcher.git\n  ```\n3. Copy [.env.example](.env.example) to `.env` and set the right environment variables as described in the official [probot docs](https://probot.github.io/docs/configuration)\n4. Install app dependencies and run the app:\n  ```sh\n  # Install dependencies\n  npm install\n\n  # Run typescript and run the bot\n  npm run build \u0026\u0026 npm start\n  ```\n\n\n## Contributing\n\nIf you have suggestions for how branch-switcher could be improved, or want to report a bug, open an issue! We'd love all and any contributions.\n\nFor more, check out the [Contributing Guide](CONTRIBUTING.md).\n\n\n## License\n\n[Apache 2.0](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fs4heid%2Fbranch-switcher","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fs4heid%2Fbranch-switcher","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fs4heid%2Fbranch-switcher/lists"}