{"id":15456118,"url":"https://github.com/gr2m/create-or-update-pull-request-action","last_synced_at":"2025-04-04T12:06:13.115Z","repository":{"id":35237182,"uuid":"210460719","full_name":"gr2m/create-or-update-pull-request-action","owner":"gr2m","description":"A GitHub Action to create or update a pull request based on local changes","archived":false,"fork":false,"pushed_at":"2024-11-14T17:55:11.000Z","size":1217,"stargazers_count":69,"open_issues_count":39,"forks_count":26,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-28T19:06:59.504Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gr2m.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"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},"funding":{"github":"gr2m"}},"created_at":"2019-09-23T22:03:58.000Z","updated_at":"2025-03-24T09:24:07.000Z","dependencies_parsed_at":"2024-03-16T14:34:08.030Z","dependency_job_id":"99379e64-8622-4fa5-ae24-ddd28b2d43fd","html_url":"https://github.com/gr2m/create-or-update-pull-request-action","commit_stats":{"total_commits":146,"total_committers":19,"mean_commits":7.684210526315789,"dds":0.678082191780822,"last_synced_commit":"488876a65a2ca38b7eb05e9086166337087f5323"},"previous_names":[],"tags_count":37,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gr2m%2Fcreate-or-update-pull-request-action","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gr2m%2Fcreate-or-update-pull-request-action/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gr2m%2Fcreate-or-update-pull-request-action/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gr2m%2Fcreate-or-update-pull-request-action/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gr2m","download_url":"https://codeload.github.com/gr2m/create-or-update-pull-request-action/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246174588,"owners_count":20735417,"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-10-01T22:22:44.690Z","updated_at":"2025-04-04T12:06:13.095Z","avatar_url":"https://github.com/gr2m.png","language":"JavaScript","funding_links":["https://github.com/sponsors/gr2m"],"categories":[],"sub_categories":[],"readme":"# Create or Update Pull Request action\n\n\u003e A GitHub Action to create or update a pull request based on local changes\n\n## Usage\n\nMinimal workflow example\n\n```yml\nname: Nightly update\non:\n  schedule:\n    # https://crontab.guru/every-night-at-midnight\n    - cron: \"0 0 * * *\"\n\njobs:\n  update_routes:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v2\n        with:\n          persist-credentials: false\n      - run: \"date \u003e datetime.txt\" # create or update a test.txt file\n      - uses: gr2m/create-or-update-pull-request-action@v1\n        env:\n          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n```\n\n`persist-credentials: false` is crucial otherwise Git push is performed with `github.token` and not the token you configure using the `env: GITHUB_TOKEN`.\n\nCustomizations\n\n```yml\nuses: gr2m/create-or-update-pull-request-action@v1\nenv:\n  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}\nwith:\n  title: \"My pull request title\"\n  body: \"My pull request body\"\n  branch: \"my-pull-request-base-branch\"\n  path: \"lib/\"\n  commit-message: \"My commit message for uncommitted changes in lib/ folder\"\n  author: \"Lorem J. Ipsum \u003clorem@example.com\u003e\"\n  labels: label1, label2\n  assignees: user1, user2\n  reviewers: user1, user2\n  team_reviewers: team1, team2\n  auto-merge: squash\n  update-pull-request-title-and-body: false\n```\n\n**Note:** `auto-merge` is optional. It can be set to `merge`, `squash`, or `rebase`. If [auto-merging](https://docs.github.com/en/github/collaborating-with-pull-requests/incorporating-changes-from-a-pull-request/automatically-merging-a-pull-request) is disabled in the repository, a warning will be logged, but the action will not fail.\n\nTo create multiple commits for different paths, use the action multiple times\n\n```yml\n- uses: gr2m/create-or-update-pull-request-action@v1\n  env:\n    GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n  with:\n    title: \"My pull request title\"\n    body: \"My pull request body\"\n    branch: \"my-pull-request-base-branch\"\n    author: \"Lorem J. Ipsum \u003clorem@example.com\u003e\"\n    path: \"cache/\"\n    commit-message: \"build: cache\"\n- uses: gr2m/create-or-update-pull-request-action@v1\n  env:\n    GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n  with:\n    branch: \"my-pull-request-base-branch\"\n    author: \"Lorem J. Ipsum \u003clorem@example.com\u003e\"\n    path: \"data/\"\n    commit-message: \"feat: data updated\"\n```\n\n## Debugging\n\nTo see additional debug logs, create a secret with the name: `ACTIONS_STEP_DEBUG` and value `true`. There is no need to pass it as `env` to steps, it will work globally.\n\n## How it works\n\nThe actions checks for local changes which can be\n\n1. Uncommitted changes such as created, updated or deleted files as shown by `git status`\n2. Local commits\n\nIf there are none, the action concludes with the \"neutral\" status\n\nIf there are changes, it does the following\n\n1. Sets `user.name` and `user.email` with `git config --global` based on the `author` input, unless it has been already set before.\n2. Looks for local changes with `git status`.\n3. Adds a new commit using the `commit-message` input if there are uncommitted changes.\n4. Pushes the local changes to remote using the branch configured in the `branch` input.\n5. Creates a pull request using the `title` and `body` inputs. If a pull request exists for the branch, it's checked out locally, rebased with `-XTheirs` and pushed with `--force` to update the pull request with the new changes.\n\nThe actions outputs following properties:\n\n- `pull-request-number` - number of created/updated PR. Not set if result is `unchanged`.\n- `result` - `created`, `updated` or `unchanged` based if the PR was created, updated or if there were no local changes.\n\nThe action is written in JavaScript. [Learn how to create your own](https://help.github.com/en/articles/creating-a-javascript-action).\n\n## Who is using it\n\n- [@octokit/routes](https://github.com/octokit/routes/blob/master/.github/workflows/update.yml)\n- [@octokit/rest.js](https://github.com/octokit/rest.js/blob/master/.github/workflows/update-rest-endpoint-methods.yml)\n- [@sinchang/cn-starbucks-stores-data](https://github.com/sinchang/cn-starbucks-stores-data/blob/master/.github/workflows/update.yml)\n- [`ergebnis/composer-normalize`](https://github.com/ergebnis/composer-normalize/blob/69ec6fd9a87cbb16badf2a988f4372221592b05e/.github/workflows/schema.yml#L25-L38)\n- [nodejs/node](https://github.com/nodejs/node/blob/master/.github/workflows/license-builder.yml)\n- [dreua/flatpak-module-qpdf-pikepdf: Flatpak modules for qpdf and pikepdf](https://github.com/dreua/flatpak-module-qpdf-pikepdf)\n\nPlease send a pull request to add yours :)\n\n## Credit\n\nInspired by the [Create Pull Request action](https://github.com/peter-evans/create-pull-request) by [@peter-evans](https://github.com/peter-evans)\n\n## License\n\n[MIT](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgr2m%2Fcreate-or-update-pull-request-action","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgr2m%2Fcreate-or-update-pull-request-action","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgr2m%2Fcreate-or-update-pull-request-action/lists"}