{"id":13538194,"url":"https://github.com/github/combine-prs","last_synced_at":"2025-04-04T10:06:08.262Z","repository":{"id":65974845,"uuid":"593706555","full_name":"github/combine-prs","owner":"github","description":"GitHub Action to combine multiple PRs into a single one","archived":false,"fork":false,"pushed_at":"2025-03-18T19:23:05.000Z","size":2900,"stargazers_count":121,"open_issues_count":8,"forks_count":6,"subscribers_count":68,"default_branch":"main","last_synced_at":"2025-03-28T09:05:47.151Z","etag":null,"topics":["actions","automation","dependabot","dependencies","pull-requests","repo-management"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/github.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":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-01-26T16:55:54.000Z","updated_at":"2025-03-10T10:19:34.000Z","dependencies_parsed_at":"2024-01-14T04:35:01.369Z","dependency_job_id":"952b0804-1c9d-4ceb-9bb9-269973d5b060","html_url":"https://github.com/github/combine-prs","commit_stats":{"total_commits":145,"total_committers":10,"mean_commits":14.5,"dds":"0.22758620689655173","last_synced_commit":"16a1198f9d63cc1a0335f42a10f08ab472cd11dd"},"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/github%2Fcombine-prs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/github%2Fcombine-prs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/github%2Fcombine-prs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/github%2Fcombine-prs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/github","download_url":"https://codeload.github.com/github/combine-prs/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247112739,"owners_count":20885606,"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":["actions","automation","dependabot","dependencies","pull-requests","repo-management"],"created_at":"2024-08-01T09:01:07.663Z","updated_at":"2025-04-04T10:06:08.217Z","avatar_url":"https://github.com/github.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# combine-prs ➡️📦⬅️\n\n[![test](https://github.com/github/combine-prs/actions/workflows/test.yml/badge.svg)](https://github.com/github/combine-prs/actions/workflows/test.yml) [![lint](https://github.com/github/combine-prs/actions/workflows/lint.yml/badge.svg)](https://github.com/github/combine-prs/actions/workflows/lint.yml) [![CodeQL](https://github.com/github/combine-prs/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/github/combine-prs/actions/workflows/codeql-analysis.yml) [![package-check](https://github.com/github/combine-prs/actions/workflows/package-check.yml/badge.svg)](https://github.com/github/combine-prs/actions/workflows/package-check.yml) [![coverage](./badges/coverage.svg)](./badges/coverage.svg)\n\nGitHub Action to combine multiple PRs into a single one\n\n## About 💡\n\nGitHub uses this Action to combine multiple dependabot PRs into a single one. Rather than having to deploy each PR individually, we can run this Action on a `cron` or `workflow_dispatch` to combine all the PRs into a single one to make dependency management just a little bit easier.\n\nThis Action is customizable so you can use it for your own purposes and it doesn't have to be specific to dependabot PRs.\n\n## Notice 📢\n\n\u003e [!NOTE]\n\u003e A notice around the [Dependabot Grouped Version Updates feature](https://github.blog/changelog/2023-06-30-grouped-version-updates-for-dependabot-public-beta/)\n\nAs mentioned above is this README, a core reason why this Action exists is to \"combine multiple Dependabot PRs into one\". Work for this Action was completed before the [GitHub Blog Post](https://github.blog/changelog/2023-06-30-grouped-version-updates-for-dependabot-public-beta/) was published and the Dependabot Grouped Version Updates feature was released. While it may seem like this Action is no longer needed due to this feature, there are actually still quite a few use cases for this Action. The first one that is front of mind is that the PRs which Dependabot opens are grouped by package manager. This means that if you have a project that uses multiple package managers, you'll still end up with multiple PRs. This Action can be used to combine those PRs into a single one. You may also want to combine pull requests that are not related to Dependabot in anyway, which this Action can also do.\n\n## Inputs 📝\n\n| Name | Description | Default | Required |\n| ---- | ----------- | ------- | -------- |\n| `github_token` | GitHub token to use for authentication within this Action. Provided for you by default! | `${{ github.token }}` | `true` |\n| `branch_prefix` | Prefix for the branch name to use for the combined PR | `dependabot` | `true` |\n| `combine_branch_name` | The branch name to use for the combined PR | `combined-prs-branch` | `false` |\n| `pr_title` | The title of the pull request to create | `Combined PRs` | `true` |\n| `pr_body_header` | The header of the pull request body | `# Combined PRs ➡️📦⬅️` | `true` |\n| `min_combine_number` | The minimum number of PRs that have to match criteria in order to create a combined PR | `\"2\"` | `true` |\n| `branch_regex` | The regex to match the branches to combine - more control than branch_prefix | `\"\"` | `false` |\n| `ci_required` | Whether or not CI should be passing to combine the PR - can be `\"true\"` or `\"false\"`  | `\"true\"` | `true` |\n| `review_required` | Whether or not reviews should be passing to combine the PR - can be `\"true\"` or `\"false\"` | `\"false\"` | `false` |\n| `ignore_label` | The label to ignore when combining PRs | `\"nocombine\"` | `true` |\n| `select_label` | The label which marks PRs that should be combined. Leave empty to consider all PRs. | `\"\"` | `false` |\n| `labels` | A comma separated list of labels to add to the combined PR - Example: `dependencies,combined-pr,etc` | `\"\"` | `false` |\n| `assignees` | A comma separated list of assignees the combined PR is assigned to - Example: `octocat` | `\"\"` | `false` |\n| `autoclose` | Whether or not to close combined PRs if the combined PR is merged - can be `\"true\"` or `\"false\"` | `\"true\"` | `false` |\n| `update_branch` | Whether or not to update the combined branch with the latest changes from the base branch after creating the combined pull request | `\"true\"` | `false` |\n| `create_from_scratch` | Whether or not to start from a clean base branch when (re)creating the combined PR | `\"false\"` | `false` |\n\n## Outputs 📤\n\n| Name | Description |\n| ---- | ----------- |\n| `pr_url` | The pull request URL if a PR was created |\n| `pr_number` | The pull request number if a PR was created |\n\n## Example 📸\n\nHere is a PR example of this Action:\n\n![example](docs/assets/example.png)\n\nThe Action ran on a cron, looked for all branches that had the `dependabot` prefix and then combined them into a single PR. Three pull requests were successfully combined and one was left out due to merge conflicts.\n\nThis allows us to deploy all the dependency updates at once rather than having to deploy each one individually.\n\n## Usage 💻\n\nHere is a brief example of how to use this Action in a workflow:\n\n```yaml\nname: Combine PRs\n\non:\n  schedule:\n    - cron: '0 1 * * 3' # Wednesday at 01:00\n  workflow_dispatch: # allows you to manually trigger the workflow\n\n# The minimum permissions required to run this Action\npermissions:\n  contents: write\n  pull-requests: write\n  checks: read\n\njobs:\n  combine-prs:\n    runs-on: ubuntu-latest\n\n    steps:\n      - name: combine-prs\n        id: combine-prs\n        uses: github/combine-prs@vX.X.X # where X.X.X is the latest version\n        with:\n          labels: combined-pr # Optional: add a label to the combined PR\n```\n\n## Permissions\n\nThis Action requires the following permissions:\n\n```yaml\n# The minimum permissions required to run this Action\npermissions:\n  contents: write # to create a new branch and merge other branches together\n  pull-requests: write # to create a new PR with the combined changes\n  checks: read # to check if CI is passing or not before combining PRs\n```\n\nThis Action also requires that GitHub Action's has permissions to create new pull requests. You can read more about this feature here: [GitHub Blog Post](https://github.blog/changelog/2022-05-03-github-actions-prevent-github-actions-from-creating-and-approving-pull-requests/)\n\nTo enable this setting, go to `Actions` \u003e `General` \u003e `Workflow permissions` in your repository settings. Check the following box and click save:\n\n![permissions](docs/assets/actions-permissions.png)\n\n## Regex Branch Patterns\n\nBy default, this Action uses the `branch_prefix` option set to `dependabot` to match the branches to combine. However, you can also use the `branch_regex` option to match branches using a regex pattern. This is useful if you want to match branches that don't have a specific prefix.\n\n`branch_regex` is a string representing a regex pattern\n\nIf `branch_regex` is set, `branch_prefix` will be ignored.\n\n## CI and Action's Token 🤖\n\nIf you need CI to re-run on your newly created \"combined\" PR, you'll need to use a token that has write access to your repository. This is because the default `github.token` that is provided to Actions prevents CI from running on new commits to prevent recursive workflows. You can use a personal access token or a GitHub App token to get around this.\n\n```yaml\n- name: combine-prs\n  id: combine-prs\n  uses: github/combine-prs@vX.X.X # where X.X.X is the latest version\n  with:\n    github_token: ${{ secrets.PAT }} # where PAT is a GitHub Action's secret containing a personal access token\n```\n\n### GitHub App Setup\n\nAlternatively, you can use a GitHub App token. This is the **recommended** approach as it is **more secure** than a personal access token and a lot more scalable for large organizations.\n\nCheckout the dedicated [documentation here](docs/github-app-setup.md) for more information on how to set this up.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgithub%2Fcombine-prs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgithub%2Fcombine-prs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgithub%2Fcombine-prs/lists"}