{"id":22318327,"url":"https://github.com/codytseng/merge-branches-github-action","last_synced_at":"2025-03-26T03:43:51.177Z","repository":{"id":65710546,"uuid":"587642175","full_name":"CodyTseng/merge-branches-github-action","owner":"CodyTseng","description":"Merge all PRs with the specified label into a branch.","archived":false,"fork":false,"pushed_at":"2023-05-08T01:19:50.000Z","size":1355,"stargazers_count":0,"open_issues_count":5,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-05T03:46:37.533Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/CodyTseng.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":"CODEOWNERS","security":null,"support":null}},"created_at":"2023-01-11T08:32:00.000Z","updated_at":"2023-01-12T07:44:58.000Z","dependencies_parsed_at":"2023-02-19T03:30:54.986Z","dependency_job_id":null,"html_url":"https://github.com/CodyTseng/merge-branches-github-action","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":"actions/typescript-action","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodyTseng%2Fmerge-branches-github-action","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodyTseng%2Fmerge-branches-github-action/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodyTseng%2Fmerge-branches-github-action/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodyTseng%2Fmerge-branches-github-action/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CodyTseng","download_url":"https://codeload.github.com/CodyTseng/merge-branches-github-action/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245585796,"owners_count":20639671,"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":"2024-12-03T23:13:07.644Z","updated_at":"2025-03-26T03:43:51.153Z","avatar_url":"https://github.com/CodyTseng.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# merge-branches-github-action\n\n\u003e Merge all PRs with the specified label into a branch.\n\n## List of input options\n\nSee [action.yml](./action.yml)\n\n| input      | description                                                                                                | required | default                       |\n| :--------- | :--------------------------------------------------------------------------------------------------------- | :------: | :---------------------------- |\n| token      | GitHub token.                                                                                              |   true   |                               |\n| base       | The name of the base branch. Merge operations will be performed on the basis of this branch.               |   true   |                               |\n| target     | The name of the target branch. This branch will be checked out from the base branch and accept all merges. |   true   |                               |\n| label-name | The name of a label to find PRs to merge.                                                                  |   true   |                               |\n| email      | The email of the committer.                                                                                |  false   | merge-branches-bot@github.com |\n| name       | The name of the committer.                                                                                 |  false   | merge-branches-bot            |\n\n## Example\n\n```yml\nname: 'merge-branches'\non:\n  workflow_dispatch:\n    inputs:\n      base:\n        description: 'The name of the base branch. Merge operations will be performed on the basis of this branch.'\n        required: true\n        default: 'main'\n        type: string\n      target:\n        description: 'The name of the target branch. This branch will be checked out from the base branch and accept all merges.'\n        required: true\n        type: string\n      label-name:\n        description: 'The name of a label to find PRs to merge.'\n        required: true\n        type: string\n\npermissions: write-all\n\njobs:\n  merge-branches:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v3\n        with:\n          fetch-depth: 0\n      - uses: codytseng/merge-branches-github-action@v1\n        with:\n          token: ${{ secrets.GITHUB_TOKEN }}\n          base: ${{ inputs.base }}\n          target: ${{ inputs.target }}\n          label-name: ${{ inputs.label-name }}\n```\n\n## How does it work?\n\n1. Get all open PRs.\n2. Find PRs containing the specified label.\n3. `git config --global user.email ${email}`\n4. `git config --global user.name ${name}`\n5. `git fetch origin`\n6. `git checkout ${base}`\n7. `git pull origin ${base}`\n8. `git branch ${target} -D`\n9. `git checkout -b ${target}`\n10. Loop branches `git merge origin/${branchName}` (Abort the merge if an error occurs.)\n11. `git push origin ${target} -f`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodytseng%2Fmerge-branches-github-action","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodytseng%2Fmerge-branches-github-action","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodytseng%2Fmerge-branches-github-action/lists"}