{"id":21496006,"url":"https://github.com/devops-infra/action-pull-request","last_synced_at":"2025-04-04T15:06:34.985Z","repository":{"id":38315472,"uuid":"255695779","full_name":"devops-infra/action-pull-request","owner":"devops-infra","description":"GitHub Action that will create a pull request from the current branch","archived":false,"fork":false,"pushed_at":"2025-04-03T19:21:03.000Z","size":498,"stargazers_count":78,"open_issues_count":11,"forks_count":22,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-03T23:41:31.626Z","etag":null,"topics":["automation","christophshyper","ci-cd","cicd","devops","devops-workflow","docker","github-action","github-actions","github-actions-docker","iaac","pull-request"],"latest_commit_sha":null,"homepage":"https://christophshyper.github.io/","language":"Shell","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/devops-infra.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":"2020-04-14T18:43:49.000Z","updated_at":"2025-03-17T20:21:48.000Z","dependencies_parsed_at":"2023-10-04T16:06:20.637Z","dependency_job_id":"f54c267a-9f65-4d9d-ba9a-777a58c7058c","html_url":"https://github.com/devops-infra/action-pull-request","commit_stats":{"total_commits":157,"total_committers":9,"mean_commits":"17.444444444444443","dds":0.3821656050955414,"last_synced_commit":"7c0a7913c37b7fafd89aa2fef564850af7fc5fb0"},"previous_names":[],"tags_count":13,"template":false,"template_full_name":"devops-infra/template-action","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devops-infra%2Faction-pull-request","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devops-infra%2Faction-pull-request/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devops-infra%2Faction-pull-request/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devops-infra%2Faction-pull-request/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/devops-infra","download_url":"https://codeload.github.com/devops-infra/action-pull-request/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247198449,"owners_count":20900079,"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","christophshyper","ci-cd","cicd","devops","devops-workflow","docker","github-action","github-actions","github-actions-docker","iaac","pull-request"],"created_at":"2024-11-23T16:14:26.498Z","updated_at":"2025-04-04T15:06:34.968Z","avatar_url":"https://github.com/devops-infra.png","language":"Shell","readme":"# GitHub Action for creating Pull Requests in a repository\n\n### Supporting `amd64` and `aarch64/arm64` images!\n\nUseful in combination with my other action [devops-infra/action-commit-push](https://github.com/devops-infra/action-commit-push).\n\nAvailable in Docker Hub: [devopsinfra/action-pull-request:latest](https://hub.docker.com/repository/docker/devopsinfra/action-pull-request)\n\u003cbr\u003e\nAnd GitHub Packages: [ghcr.io/devops-infra/action-pull-request/action-pull-request:latest](https://github.com/devops-infra/action-pull-request/packages)\n\n\nFeatures:\n* Creates pull request if triggered from a current branch or any specified by `source_branch` to a `target_branch`.\n* Title and body of a pull request can be specified with `title` and `body`.\n* Can assign `assignee`, `reviewer`, one or more `label`, a `milestone` or mark it as a `draft`\n* Can replace any `old_string` inside a pull request template with a `new_string`. Or put commits' subjects in place of `old_string`.\n* When `get_diff` is `true` will add list of commits in place of `\u003c!-- Diff commits --\u003e` and list of modified files in place of `\u003c!-- Diff files --\u003e` in a pull request template.\n* When `allow_no_diff` is set to true will continue execution and create pull request even if both branches have no differences, e.g. having only a merge commit.\n\n## Badge swag\n[![Master branch](https://github.com/devops-infra/action-pull-request/workflows/Master%20branch/badge.svg)](https://github.com/devops-infra/action-pull-request/actions?query=workflow%3A%22Master+branch%22)\n[![Other branches](https://github.com/devops-infra/action-pull-request/workflows/Other%20branches/badge.svg)](https://github.com/devops-infra/action-pull-request/actions?query=workflow%3A%22Other+branches%22)\n\u003cbr\u003e\n[\n![GitHub repo](https://img.shields.io/badge/GitHub-devops--infra%2Faction--pull--request-blueviolet.svg?style=plastic\u0026logo=github)\n![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/devops-infra/action-pull-request?color=blueviolet\u0026label=Code%20size\u0026style=plastic\u0026logo=github)\n![GitHub last commit](https://img.shields.io/github/last-commit/devops-infra/action-pull-request?color=blueviolet\u0026logo=github\u0026style=plastic\u0026label=Last%20commit)\n![GitHub license](https://img.shields.io/github/license/devops-infra/action-pull-request?color=blueviolet\u0026logo=github\u0026style=plastic\u0026label=License)\n](https://github.com/devops-infra/action-pull-request \"shields.io\")\n\u003cbr\u003e\n[\n![DockerHub](https://img.shields.io/badge/DockerHub-devopsinfra%2Faction--pull--request-blue.svg?style=plastic\u0026logo=docker)\n![Docker version](https://img.shields.io/docker/v/devopsinfra/action-pull-request?color=blue\u0026label=Version\u0026logo=docker\u0026style=plastic)\n![Image size](https://img.shields.io/docker/image-size/devopsinfra/action-pull-request/latest?label=Image%20size\u0026style=plastic\u0026logo=docker)\n![Docker Pulls](https://img.shields.io/docker/pulls/devopsinfra/action-pull-request?color=blue\u0026label=Pulls\u0026logo=docker\u0026style=plastic)\n](https://hub.docker.com/r/devopsinfra/action-pull-request \"shields.io\")\n\n\n## Reference\n\n```yaml\n    - name: Run the Action\n      uses: devops-infra/action-pull-request@master\n      with:\n        github_token: ${{ secrets.GITHUB_TOKEN }}\n        source_branch: development\n        target_branch: master\n        title: My pull request\n        template: .github/PULL_REQUEST_TEMPLATE.md\n        body: \"**Automated pull request**\"\n        reviewer: octocat\n        assignee: octocat\n        label: enhancement\n        milestone: My milestone\n        draft: true\n        old_string: \"\u003c!-- Add your description here --\u003e\"\n        new_string: \"** Automatic pull request**\"\n        get_diff: true\n        ignore_users: \"dependabot\"\n        allow_no_diff: false\n```\n\n\n| Input Variable | Required | Default                       | Description                                                                                                              |\n| -------------- | -------- | ----------------------------- | ------------------------------------------------------------------------------------------------------------------------ |\n| github_token   | Yes      | `\"\"`                          | GitHub token `${{ secrets.GITHUB_TOKEN }}`                                                                               |\n| allow_no_diff  | No       | `false`                       | Allows to continue on merge commits with no diffs.                                                                       |\n| assignee       | No       | `\"\"`                          | Assignee's usernames.                                                                                                    |\n| body           | No       | *list of commits*             | Pull request body.                                                                                                       |\n| draft          | No       | `false`                       | Whether to mark it as a draft.                                                                                           |\n| get_diff       | No       | `false`                       | Whether to replace predefined comments with differences between branches - see details below.                            |\n| ignore_users   | No       | `\"dependabot\"`                | List of users to ignore, coma separated.                                                                                 |\n| label          | No       | `\"\"`                          | Labels to apply, coma separated.                                                                                         |\n| milestone      | No       | `\"\"`                          | Milestone.                                                                                                               |\n| new_string     | No       | `\"\"`                          | New string for the replacement in the template. If not specified, but `old_string` was, it will gather commits subjects. |\n| old_string     | No       | `\"\"`                          | Old string for the replacement in the template.                                                                          |\n| reviewer       | No       | `\"\"`                          | Reviewer's username.                                                                                                     |\n| source_branch  | No       | *current branch*              | Name of the source branch.                                                                                               |\n| target_branch  | No       | `master`                      | Name of the target branch. Change it if you use `main`.                                                                  |\n| template       | No       | `\"\"`                          | Template file location.                                                                                                  |\n| title          | No       | *subject of the first commit* | Pull request title.                                                                                                      |\n\n\n| Outputs   | Description                   |\n| --------- | ----------------------------- |\n| url       | Pull request URL              |\n| pr_number | Number of GitHub pull request |\n\n\n### How get_diff works\nIn previous versions occurrences of following strings in a template result with replacing them with list of commits and list of modified files (`\u003c!-- Diff commits --\u003e` and `\u003c!-- Diff files --\u003e`).\n\nNow this action will expect to have three types of comment blocks. Meaning anything between `START` and `END` comment will get replaced. This is especially important when updating pull request with new commits.\n\n* `\u003c!-- Diff summary - START --\u003e` and `\u003c!-- Diff summary - END --\u003e` - show first lines of each commit the pull requests\n* `\u003c!-- Diff commits - START --\u003e` and `\u003c!-- Diff commits - END --\u003e` - show graph of commits in the pull requests, with authors' info and time\n* `\u003c!-- Diff files - START --\u003e` and `\u003c!-- Diff files - END --\u003e` - show list of modified files\n\nIf your template uses old comment strings it will try to adjust them in the pull request body to a new standard when pull request is created. It will not modify the template.\n\n**CAUTION**\nRemember to not use default `fetch-depth` for [actions/checkout](https://github.com/actions/checkout) action. Rather set it to `0` - see example below.\n\n\n## Examples\n\nRed ares show fields that can be dynamically expanded based on commits to the current branch.\nBlue areas show fields that can be set in action configuration.\n![Example screenshot](https://github.com/devops-infra/action-pull-request/raw/master/action-pull-request.png)\n\n\nCreate pull request for non-master branches\n```yaml\nname: Run the Action on each commit\non:\n  push:\n    branches-ignore: master\njobs:\n  action-pull-request:\n    runs-on: ubuntu-latest\n    steps:\n      - name: Checkout repository\n        uses: actions/checkout@v2\n      - name: Create pull request\n        uses: devops-infra/action-pull-request@master\n        with:\n          github_token: ${{ secrets.GITHUB_TOKEN }}\n          title: Automatic pull request\n```\n\nUse first commit as a title and part of body, add a label based on a branch name, add git differences in the template\n```yaml\nname: Run the Action on each commit\non:\n  push:\n    branches-ignore: master\njobs:\n  action-pull-request:\n    runs-on: ubuntu-latest\n    steps:\n      - name: Checkout repository\n        uses: actions/checkout@master\n        with:\n          fetch-depth: 0\n      - name: Run the Action\n        if: startsWith(github.ref, 'refs/heads/feature')\n        uses: devops-infra/action-pull-request@master\n        with:\n          github_token: ${{ secrets.GITHUB_TOKEN }}\n          title: ${{ github.event.commits[0].message }}\n          assignee: ${{ github.actor }}\n          label: automatic,feature\n          template: .github/PULL_REQUEST_TEMPLATE/FEATURE.md\n          old_string: \"**Write you description here**\"\n          new_string: ${{ github.event.commits[0].message }}\n          get_diff: true\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevops-infra%2Faction-pull-request","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevops-infra%2Faction-pull-request","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevops-infra%2Faction-pull-request/lists"}