GithubHelp home page GithubHelp logo

peter-evans / create-pull-request Goto Github PK

View Code? Open in Web Editor NEW
1.9K 22.0 388.0 28.05 MB

A GitHub action to create a pull request for changes to your repository in the actions workspace

License: MIT License

JavaScript 0.19% TypeScript 98.44% Shell 1.37%
create-pull-request github-action pull-request actions-workspace workflow ci-cd automation

create-pull-request's Introduction

Create Pull Request

CI GitHub Marketplace

A GitHub action to create a pull request for changes to your repository in the actions workspace.

Changes to a repository in the Actions workspace persist between steps in a workflow. This action is designed to be used in conjunction with other steps that modify or add files to your repository. The changes will be automatically committed to a new branch and a pull request created.

Create Pull Request action will:

  1. Check for repository changes in the Actions workspace. This includes:
    • untracked (new) files
    • tracked (modified) files
    • commits made during the workflow that have not been pushed
  2. Commit all changes to a new branch, or update an existing pull request branch.
  3. Create a pull request to merge the new branch into the baseβ€”the branch checked out in the workflow.

Documentation

Usage

      - uses: actions/checkout@v4

      # Make changes to pull request here

      - name: Create Pull Request
        uses: peter-evans/create-pull-request@v6

You can also pin to a specific release version in the format @v6.x.x

Workflow permissions

For this action to work you must explicitly allow GitHub Actions to create pull requests. This setting can be found in a repository's settings under Actions > General > Workflow permissions.

For repositories belonging to an organization, this setting can be managed by admins in organization settings under Actions > General > Workflow permissions.

Action inputs

All inputs are optional. If not set, sensible defaults will be used.

Note: If you want pull requests created by this action to trigger an on: push or on: pull_request workflow then you cannot use the default GITHUB_TOKEN. See the documentation here for workarounds.

Name Description Default
token GITHUB_TOKEN (permissions contents: write and pull-requests: write) or a repo scoped Personal Access Token (PAT). GITHUB_TOKEN
git-token The Personal Access Token (PAT) that the action will use for git operations. Defaults to the value of token
path Relative path under GITHUB_WORKSPACE to the repository. GITHUB_WORKSPACE
add-paths A comma or newline-separated list of file paths to commit. Paths should follow git's pathspec syntax. If no paths are specified, all new and modified files are added. See Add specific paths.
commit-message The message to use when committing changes. See commit-message. [create-pull-request] automated change
committer The committer name and email address in the format Display Name <[email protected]>. Defaults to the GitHub Actions bot user. github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
author The author name and email address in the format Display Name <[email protected]>. Defaults to the user who triggered the workflow run. ${{ github.actor }} <${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com>
signoff Add Signed-off-by line by the committer at the end of the commit log message. false
branch The pull request branch name. create-pull-request/patch
delete-branch Delete the branch if it doesn't have an active pull request associated with it. See delete-branch. false
branch-suffix The branch suffix type when using the alternative branching strategy. Valid values are random, timestamp and short-commit-hash. See Alternative strategy for details.
base Sets the pull request base branch. Defaults to the branch checked out in the workflow.
push-to-fork A fork of the checked-out parent repository to which the pull request branch will be pushed. e.g. owner/repo-fork. The pull request will be created to merge the fork's branch into the parent's base. See push pull request branches to a fork for details.
title The title of the pull request. Changes by create-pull-request action
body The body of the pull request. Automated changes by [create-pull-request](https://github.com/peter-evans/create-pull-request) GitHub action
body-path The path to a file containing the pull request body. Takes precedence over body.
labels A comma or newline-separated list of labels.
assignees A comma or newline-separated list of assignees (GitHub usernames).
reviewers A comma or newline-separated list of reviewers (GitHub usernames) to request a review from.
team-reviewers A comma or newline-separated list of GitHub teams to request a review from. Note that a repo scoped PAT, or equivalent GitHub App permissions, are required.
milestone The number of the milestone to associate this pull request with.
draft Create a draft pull request. It is not possible to change draft status after creation except through the web interface. false

commit-message

In addition to a message, the commit-message input can also be used to populate the commit description. Leave a single blank line between the message and description.

          commit-message: |
            the first line is the commit message

            the commit description starts
            after a blank line and can be
            multiple lines

delete-branch

The delete-branch feature doesn't delete branches immediately on merge. (It can't do that because it would require the merge to somehow trigger the action.) The intention of the feature is that when the action next runs it will delete the branch if there is no diff.

Enabling this feature leads to the following behaviour:

  1. If a pull request was merged and the branch is left undeleted, when the action next runs it will delete the branch if there is no further diff.
  2. If a pull request is open, but there is now no longer a diff and the PR is unnecessary, the action will delete the branch causing the PR to close.

If you want branches to be deleted immediately on merge then you should use GitHub's Automatically delete head branches feature in your repository settings.

Proxy support

For self-hosted runners behind a corporate proxy set the https_proxy environment variable.

      - name: Create Pull Request
        uses: peter-evans/create-pull-request@v6
        env:
          https_proxy: http://<proxy_address>:<port>

Action outputs

The following outputs can be used by subsequent workflow steps.

  • pull-request-number - The pull request number.
  • pull-request-url - The URL of the pull request.
  • pull-request-operation - The pull request operation performed by the action, created, updated or closed.
  • pull-request-head-sha - The commit SHA of the pull request branch.

Step outputs can be accessed as in the following example. Note that in order to read the step outputs the action step must have an id.

      - name: Create Pull Request
        id: cpr
        uses: peter-evans/create-pull-request@v6
      - name: Check outputs
        if: ${{ steps.cpr.outputs.pull-request-number }}
        run: |
          echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
          echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}"

Action behaviour

The default behaviour of the action is to create a pull request that will be continually updated with new changes until it is merged or closed. Changes are committed and pushed to a fixed-name branch, the name of which can be configured with the branch input. Any subsequent changes will be committed to the same branch and reflected in the open pull request.

How the action behaves:

  • If there are changes (i.e. a diff exists with the checked-out base branch), the changes will be pushed to a new branch and a pull request created.
  • If there are no changes (i.e. no diff exists with the checked-out base branch), no pull request will be created and the action exits silently.
  • If a pull request already exists it will be updated if necessary. Local changes in the Actions workspace, or changes on the base branch, can cause an update. If no update is required the action exits silently.
  • If a pull request exists and new changes on the base branch make the pull request unnecessary (i.e. there is no longer a diff between the pull request branch and the base), the pull request is automatically closed. Additionally, if delete-branch is set to true the branch will be deleted.

For further details about how the action works and usage guidelines, see Concepts, guidelines and advanced usage.

Alternative strategy - Always create a new pull request branch

For some use cases it may be desirable to always create a new unique branch each time there are changes to be committed. This strategy is not recommended because if not used carefully it could result in multiple pull requests being created unnecessarily. If in doubt, use the default strategy of creating an updating a fixed-name branch.

To use this strategy, set input branch-suffix with one of the following options.

  • random - Commits will be made to a branch suffixed with a random alpha-numeric string. e.g. create-pull-request/patch-6qj97jr, create-pull-request/patch-5jrjhvd

  • timestamp - Commits will be made to a branch suffixed by a timestamp. e.g. create-pull-request/patch-1569322532, create-pull-request/patch-1569322552

  • short-commit-hash - Commits will be made to a branch suffixed with the short SHA1 commit hash. e.g. create-pull-request/patch-fcdfb59, create-pull-request/patch-394710b

Controlling committed files

The action defaults to adding all new and modified files. If there are files that should not be included in the pull request, you can use the following methods to control the committed content.

Remove files

The most straightforward way to handle unwanted files is simply to remove them in a step before the action runs.

      - run: |
          rm -rf temp-dir
          rm temp-file.txt

Ignore files

If there are files or directories you want to ignore you can simply add them to a .gitignore file at the root of your repository. The action will respect this file.

Add specific paths

You can control which files are committed with the add-paths input. Paths should follow git's pathspec syntax. File changes that do not match one of the paths will be stashed and restored after the action has completed.

      - name: Create Pull Request
        uses: peter-evans/create-pull-request@v6
        with:
          add-paths: |
            *.java
            docs/*.md

Create your own commits

As well as relying on the action to handle uncommitted changes, you can additionally make your own commits before the action runs. Note that the repository must be checked out on a branch with a remote, it won't work for events which checkout a commit.

    steps:
      - uses: actions/checkout@v4
      - name: Create commits
        run: |
          git config user.name 'Peter Evans'
          git config user.email '[email protected]'
          date +%s > report.txt
          git commit -am "Modify tracked file during workflow"
          date +%s > new-report.txt
          git add -A
          git commit -m "Add untracked file during workflow"
      - name: Uncommitted change
        run: date +%s > report.txt
      - name: Create Pull Request
        uses: peter-evans/create-pull-request@v6

Create a project card

To create a project card for the pull request, pass the pull-request-number step output to create-or-update-project-card action.

      - name: Create Pull Request
        id: cpr
        uses: peter-evans/create-pull-request@v6

      - name: Create or Update Project Card
        if: ${{ steps.cpr.outputs.pull-request-number }}
        uses: peter-evans/create-or-update-project-card@v2
        with:
          project-name: My project
          column-name: My column
          issue-number: ${{ steps.cpr.outputs.pull-request-number }}

Auto-merge

Auto-merge can be enabled on a pull request allowing it to be automatically merged once requirements have been satisfied. See enable-pull-request-automerge action for usage details.

Reference Example

The following workflow sets many of the action's inputs for reference purposes. Check the defaults to avoid setting inputs unnecessarily.

See examples for more realistic use cases.

jobs:
  createPullRequest:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Make changes to pull request
        run: date +%s > report.txt

      - name: Create Pull Request
        id: cpr
        uses: peter-evans/create-pull-request@v6
        with:
          token: ${{ secrets.PAT }}
          commit-message: Update report
          committer: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
          author: ${{ github.actor }} <${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com>
          signoff: false
          branch: example-patches
          delete-branch: true
          title: '[Example] Update report'
          body: |
            Update report
            - Updated with *today's* date
            - Auto-generated by [create-pull-request][1]

            [1]: https://github.com/peter-evans/create-pull-request
          labels: |
            report
            automated pr
          assignees: peter-evans
          reviewers: peter-evans
          team-reviewers: |
            developers
            qa-team
          milestone: 1
          draft: false

An example based on the above reference configuration creates pull requests that look like this:

Pull Request Example

License

MIT

create-pull-request's People

Contributors

actions-bot avatar campersau avatar chrisbruford avatar christopherthielen avatar dannyroberts avatar dependabot[bot] avatar dezren39 avatar fharper avatar github-actions[bot] avatar hartwork avatar irphilli avatar jderusse avatar jonico avatar jsoref avatar kenji-miyake avatar leeopop avatar michaelcurrin avatar okuramasafumi avatar peter-evans avatar pvogt09 avatar qoutland avatar renovate-bot avatar renovate[bot] avatar salexander6 avatar scriptautomate avatar sibiraj-s avatar staabm avatar stefanbuck avatar tillganster avatar willthames avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

create-pull-request's Issues

Support creating PRs in other repos

Subject of the issue

It would be ideal to support creating PRs (using a custom personal access token) to remote repositories, using the git remote information.

Steps to reproduce

Given a workflow like:

on: [push]

jobs:
  create-pr-on-remote-repo:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
        with:
          token: ${{ secrets.PERSONAL_TOKEN }}
          repository: remote_owner/remote_repo
      - run: 'echo "v1.0" > .version'
      - uses: peter-evans/[email protected]
        with:
          token: ${{ secrets.PERSONAL_TOKEN }}
          branch: auto-update-workflows-docs

I would expect:

βœ… Creates PR in remote repository

but

❌ Tries to create PR in workflow's repo:

Pull request branch to create or update set to 'create-pull-request/patch'
Configured git committer as 'GitHub <[email protected]>'
Configured git author as 'github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>'
Uncommitted changes found. Adding a commit.
Pull request branch 'create-pull-request/patch' does not exist yet
Created branch 'create-pull-request/patch'
Pushing pull request branch to 'origin/create-pull-request/patch'

Traceback (most recent call last):
  File "/home/runner/work/_actions/peter-evans/create-pull-request/v2.2.0/dist/src/create_pull_request.py", line 174, in <module>
    repo.git.push("--force", repo_url, f"HEAD:refs/heads/{branch}")
  File "/opt/hostedtoolcache/Python/3.8.1/x64/lib/python3.8/site-packages/git/cmd.py", line 551, in <lambda>
    return lambda *args, **kwargs: self._call_process(name, *args, **kwargs)
  File "/opt/hostedtoolcache/Python/3.8.1/x64/lib/python3.8/site-packages/git/cmd.py", line 1020, in _call_process
    return self.execute(call, **exec_kwargs)
  File "/opt/hostedtoolcache/Python/3.8.1/x64/lib/python3.8/site-packages/git/cmd.py", line 831, in execute
    raise GitCommandError(command, status, stderr_value, stdout_value)

git.exc.GitCommandError: Cmd('git') failed due to: exit code(1)
  cmdline: git push --force ***github.com/current_owner/current_repo HEAD:refs/heads/create-pull-request/patch
  stderr: 'To https://github.com/current_owner/current_repo
 ! [remote rejected] HEAD -> create-pull-request/patch (shallow update not allowed)

error: failed to push some refs to '***github.com/current_owner/current_repo''

##[error]The process '/opt/hostedtoolcache/Python/3.8.1/x64/bin/python' failed with exit code 1

##[error]Node run failed with exit code 1

[v1] create-pull-request action suddenly stop working

Subject of the issue

We have been using create-pull-request action until 16th febrary without any problem. But suddenly it stopped working with this error while running create-pull-request.py, We didn't touched anything related with github actions which can cause this error so idk where to start debugging. Any idea on how to fix it?

2020-02-18T14:06:06.9197382Z ##[group]Run peter-evans/create-pull-request@v1
2020-02-18T14:06:06.9197523Z with:
2020-02-18T14:06:06.9198054Z   token: ***
2020-02-18T14:06:06.9198154Z   title: Automatic i18n files update
2020-02-18T14:06:06.9198271Z   body: I18n files need an update
2020-02-18T14:06:06.9198394Z   commit-message: Update i18n files (automatic commit)
2020-02-18T14:06:06.9198514Z   branch-suffix: none
2020-02-18T14:06:06.9198626Z   branch: auto_feature/i18n
2020-02-18T14:06:06.9198745Z ##[endgroup]
2020-02-18T14:06:07.3017049Z [command]pip install --requirement /home/runner/work/_actions/peter-evans/create-pull-request/v1/dist/src/requirements.txt
2020-02-18T14:06:08.0258290Z Collecting GitPython==3.0.5
2020-02-18T14:06:08.0967103Z   Downloading GitPython-3.0.5-py3-none-any.whl (455 kB)
2020-02-18T14:06:08.2418948Z Collecting PyGithub==1.44.1
2020-02-18T14:06:08.2576614Z   Downloading PyGithub-1.44.1.tar.gz (110 kB)
2020-02-18T14:06:08.5860870Z Collecting gitdb2>=2.0.0
2020-02-18T14:06:08.6000136Z   Downloading gitdb2-3.0.2-py2.py3-none-any.whl (63 kB)
2020-02-18T14:06:08.6515068Z Collecting deprecated
2020-02-18T14:06:08.6653991Z   Downloading Deprecated-1.2.7-py2.py3-none-any.whl (8.3 kB)
2020-02-18T14:06:08.7260746Z Collecting pyjwt
2020-02-18T14:06:08.7397236Z   Downloading PyJWT-1.7.1-py2.py3-none-any.whl (18 kB)
2020-02-18T14:06:08.8242948Z Collecting requests>=2.14.0
2020-02-18T14:06:08.8391678Z   Downloading requests-2.22.0-py2.py3-none-any.whl (57 kB)
2020-02-18T14:06:08.9056093Z Collecting six
2020-02-18T14:06:08.9196720Z   Downloading six-1.14.0-py2.py3-none-any.whl (10 kB)
2020-02-18T14:06:08.9461510Z Collecting smmap2>=2.0.0
2020-02-18T14:06:08.9775482Z   Downloading smmap2-2.0.5-py2.py3-none-any.whl (24 kB)
2020-02-18T14:06:09.0117233Z Collecting wrapt<2,>=1.10
2020-02-18T14:06:09.0252271Z   Downloading wrapt-1.12.0.tar.gz (27 kB)
2020-02-18T14:06:09.3018030Z Collecting urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1
2020-02-18T14:06:09.3167536Z   Downloading urllib3-1.25.8-py2.py3-none-any.whl (125 kB)
2020-02-18T14:06:09.3880363Z Collecting certifi>=2017.4.17
2020-02-18T14:06:09.4019778Z   Downloading certifi-2019.11.28-py2.py3-none-any.whl (156 kB)
2020-02-18T14:06:09.4559740Z Collecting chardet<3.1.0,>=3.0.2
2020-02-18T14:06:09.4702517Z   Downloading chardet-3.0.4-py2.py3-none-any.whl (133 kB)
2020-02-18T14:06:09.5368052Z Collecting idna<2.9,>=2.5
2020-02-18T14:06:09.5508978Z   Downloading idna-2.8-py2.py3-none-any.whl (58 kB)
2020-02-18T14:06:09.6190545Z Installing collected packages: smmap2, gitdb2, GitPython, wrapt, deprecated, pyjwt, urllib3, certifi, chardet, idna, requests, six, PyGithub
2020-02-18T14:06:09.8771087Z     Running setup.py install for wrapt: started
2020-02-18T14:06:11.1638639Z     Running setup.py install for wrapt: finished with status 'done'
2020-02-18T14:06:11.5781798Z     Running setup.py install for PyGithub: started
2020-02-18T14:06:11.9628815Z     Running setup.py install for PyGithub: finished with status 'done'
2020-02-18T14:06:11.9829082Z Successfully installed GitPython-3.0.5 PyGithub-1.44.1 certifi-2019.11.28 chardet-3.0.4 deprecated-1.2.7 gitdb2-3.0.2 idna-2.8 pyjwt-1.7.1 requests-2.22.0 six-1.14.0 smmap2-2.0.5 urllib3-1.25.8 wrapt-1.12.0
2020-02-18T14:06:12.1629645Z [command]python /home/runner/work/_actions/peter-evans/create-pull-request/v1/dist/src/create-pull-request.py
2020-02-18T14:06:12.2120813Z Traceback (most recent call last):
2020-02-18T14:06:12.2122695Z   File "/home/runner/work/_actions/peter-evans/create-pull-request/v1/dist/src/create-pull-request.py", line 9, in <module>
2020-02-18T14:06:12.2123400Z     from git import Repo
2020-02-18T14:06:12.2124341Z   File "/opt/hostedtoolcache/Python/3.8.1/x64/lib/python3.8/site-packages/git/__init__.py", line 38, in <module>
2020-02-18T14:06:12.2124899Z     from git.exc import *                       # @NoMove @IgnorePep8
2020-02-18T14:06:12.2125835Z   File "/opt/hostedtoolcache/Python/3.8.1/x64/lib/python3.8/site-packages/git/exc.py", line 9, in <module>
2020-02-18T14:06:12.2126739Z     from git.compat import UnicodeMixin, safe_decode, string_types
2020-02-18T14:06:12.2127627Z   File "/opt/hostedtoolcache/Python/3.8.1/x64/lib/python3.8/site-packages/git/compat.py", line 16, in <module>
2020-02-18T14:06:12.2128160Z     from gitdb.utils.compat import (
2020-02-18T14:06:12.2128955Z ModuleNotFoundError: No module named 'gitdb.utils.compat'
2020-02-18T14:06:12.2177962Z ##[error]The process 'python' failed with exit code 1
2020-02-18T14:06:12.2293630Z ##[error]Node run failed with exit code 1

Steps to reproduce

Our relevant github action config is:

    - name: Create Pull Request
      uses: peter-evans/create-pull-request@v1
      with:
        token: ${{ secrets.GITHUB_TOKEN }}
        title: 'Automatic i18n files update'
        body: 'I18n files need an update'
        commit-message: 'Update i18n files (automatic commit)'
        branch-suffix: none
        branch: auto_feature/i18n

Include vendors in this repository?

This action is written in JavaScript, but all the .js does is to start installing Python dependencies and to shell out to python.

That means that dependencies have to be downloaded an installed every time the action runs, which wastes bandwith, CPU, resources in general, increases the the time it takes to run. Additionally, action runs might not be repeatable.

Since GitHub Actions can also be docker containers, would you πŸ‘ an attempt to move the relevant python stuff into a Docker container so that we could pull a finished Docker image off the Docker hub or the GitHub Package Registry?

Keeps on failing: fatal: ref HEAD is not a symbolic ref

I have the following Github workflow

name: Misspells
on: [pull_request,push]
jobs:
  misspell:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v2
      - name: sobolevn fixer
        uses: sobolevn/misspell-fixer-action@master
      - uses: peter-evans/[email protected]
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
          commit-message: 'Typos fixes'
          title: "Typos fixes"
          branch: typos
          branch-suffix: timestamp

But unfortunately it fails with the logs when a pull request is made:

Target repository set to qdm12/pingodown
  stderr: 'fatal: ref HEAD is not a symbolic ref'
##[error]The checked out ref is not a valid base for a pull request. Unable to continue. Exiting.
##[error]The process '/opt/hostedtoolcache/Python/3.8.2/x64/bin/python' failed with exit code 1
/usr/bin/git config --local --add http.https://github.com/.extraheader AUTHORIZATION: basic ***

Full log

Example of PR from typo branch

Any help would be greatly appreciated as I would ideally like to use this action for other workflows as well! πŸ‘

Scheduled actions raise duplicate PRs

This is a really awesome action. Thanks for your efforts here. πŸŽ‰

I have a scheduled action which runs hourly and sometimes makes changes to the repo based on external resources.

If the action doesn't make any changes to the repo then create-pull-request succeeds but doesn't raise a PR. Great!

If my action does make changes then create-pull-request opens a pull request for me. Also great!

If I haven't merged that PR by the time it runs again it makes and same changes and raises a duplicate PR with the same name and diff. Less great...

Is it possible to add support for not raising duplicate PRs in this case? Potentially by checking open PRs for the same title or diff?

Commits seem to be rebased incorrectly with `BRANCH_SUFFIX: none`

We have a cron that schedules create-pull-request to run hourly, and configured with BRANCH_SUFFIX: none. After the first commit, further updates are rebased in such a way that the contents of the branch do not change.

As real example, here are two commits generated:

The PR containing them is DMOJ/online-judge#1101, and the order they appear in is swapped.

It seems like when updating, create-pull-request rebases the original PR on the new code with -Xtheirs, instead of the other way around... so the contents of the PR branch never change.

New files created but no PR is made

I've created a new file, but when I run the action all it outputs is "Repository has no modified or untracked files. Skipping.". I've confirmed that right before I run create-pull-request, a git status shows my new file. I'm not sure what's breaking since the script isn't logging anything other than the skipping notification.

I suspect there's an issue with the logic here:

try:
git.stash('pop')
except BaseException:
git.checkout('--theirs', '.')
git.reset()

It looks like if we hit this except: block that we'll never recover our changes from the stash? I'm not a git expert so my understanding here may be wrong, but seems like we can't recover correctly in this case. I'll keep digging in and let you know if I figure out what's going on.

edit: yeah, this is definitely what's wrong. Got some output from that except handler:

Exception in checkout_branch
Cmd('git') failed due to: exit code(1)
  cmdline: git stash pop
  stdout: 'The stash entry is kept in case you need it again.'
  stderr: '.github/workflows/update-owning-team.yml already exists, no checkout
error: could not restore untracked files from stash'

edit2: Okay, I think I understand the problem. It looks like a previous run of the action successfully created the branch but errored out before it could make a PR. So the branch is there, I just can't see it. The action then (perhaps correctly) bails out without doing anything since the branch is up-to-date.

Maybe we need to check on the PR status directly?

REPO_ACCESS_TOKEN is not necessary

Hey there,

I was just looking for an action that would allow me to create a pull request. I read that you use REPO_ACCESS_TOKEN in "order to commit", but you can in fact use GITHUB_TOKEN to push back to the repository, I did it a several times myself. You will need to configure user.email and user.name. Example:

https://github.com/octokit/routes/blob/72f18c4272acebab61e9decc99d6e2d9b40ce2a6/.github/workflows/nightly-update.yml#L21-L24

Then the trick is to prefix the token with x-access-token: in the Git URL, as I've done here:
https://github.com/octokit/routes/blob/72f18c4272acebab61e9decc99d6e2d9b40ce2a6/lib/notify-about-routes-changes.js#L42

The reason this prefix is necessary is that the GITHUB_TOKEN is in fact an installation token (GitHub Actions is basically an internal GitHub App). But you can use installation tokens for Git access. See https://developer.github.com/apps/building-github-apps/authenticating-with-github-apps/#http-based-git-access-by-an-installation

Hope that helps :)

PR against fork

This issue is not identical to #71

The purpose is to run the Action in the main repo. But use SSH to push code in a fork.

Why:

  • least privilege: the SSH key does not grant access to the main repo, but just to a fork
    - name: Set up SSH
      uses: webfactory/[email protected]
      with:
        ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}

    - name: Checkout via SSH
      run: |
        git clone --branch master [email protected]:${{ github.repository }}.git .
        git remote set-url origin [email protected]:fork/fork.git .

    - name: Task
      run: |
        touch foo
   
    - name: Create Pull Request
      uses: peter-evans/create-pull-request@v2
      with:
        token: ${{ secrets.GITHUB_TOKEN }}
        branch: fork:bot-code-update <= ??
        head_repository: fork <= ??

Action fails

I've setup to use your action in a workflow of mine but it failed. Any idea what the problem could be? I'm not a Python developer so I'm not sure what went wrong exactly.

This is the error I got

Traceback (most recent call last):
File "/create-pull-request.py", line 126, in
if not ignore_event(github_event):
File "/create-pull-request.py", line 26, in ignore_event
deleted = "{deleted}".format(**github_event)
KeyError: 'deleted'

https://github.com/octokit/rest.js/commit/1803cdcc0c6ee202528c00595338e72fb624c259/checks#step:8:16

Container does not support git-lfs

When trying to run this action with a repo that is using git-lfs it errors out with the following error: This repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting .git/hooks/post-checkout.

I tried installing git-lfs python package, which did not work since it must be called using python3 -m git_lfs vs the required git-lfs.

I will later be submitting a PR to fix this issue, by changing the base image to alpine and installing required packages. Up to you if you want to accept it, but it works for me here:
https://github.com/qoutland/create-pull-request

use this action on a private repo

I try to build a workflow in which I copy a file from a source repo into a dest repo while using pull requests.

my workflow which is triggered via a slash-command (thx for another great action ;-)) looks like

name: Sync automation templates into our php repositories

on:
  repository_dispatch:
    types: [sync-command] # triggered by /sync PR comment

jobs:

  template-sync:
    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v2
      with:
        token: ${{ secrets.STAABM_TOKEN }}
        repository: complex-gmbh/php-automation-templates
        ref: master
        path: templates-master

    - uses: actions/checkout@v2
      with:
        token: ${{ secrets.STAABM_TOKEN }}
        repository: complex-gmbh/kunzmann
        ref: production
        path: kunzmann
        
    - run: |
        cp templates-master/templates/pr-badge-fast-track.yml kunzmann/.github/pr-badge-fast-track.yml
        
    - name: Create Pull Request
      uses: peter-evans/create-pull-request@v2
      with:
        path: kunzmann
        token: ${{ secrets.STAABM_TOKEN }}

I am wondering that I can see "permisson-errors" and got the impression that this create-pull-request action might not work for private repos?

grafik

Question: Raise PR on separate sub-directory repo?

I've got kind of an obscure use case, but I need to raise a PR on a separate repo B as the last step of a pipeline on repo A.

The checkout action supports checking out to a separate working directory. Is there a way I can tell the create-pull-request action to raise the PR against the repo in that sub-directory?

      - name: Checkout repo B
        uses: actions/checkout@v2
        with:
          repository: myorg/b
          token: ${{ secrets.CI_USER_TOKEN }}
          path: repo-b

I can see the files in the repo using:

      - name: Check repo B files
        working-directory: ./repo-b
        run: |
          ls -la

Just can't figure out how to have the create-pull-request action use that working directory.

Thanks for putting this project out there!

Fails to create pull request when changes already committed

After manually creating a commit with git commit in a previous step create-pull-request fails to create a pull request.

No modified or untracked files detected. Skipping.

This starts to become an issue when you need full control over the commits that are being created (or at least more than create-pull-request can reasonably provide).

When using with Cron syntax.

Thank you for the great plugin.

When I using with Cron schedule syntax.

on:
 schedule:
 - cron: '*/5 * * * *'

That happened this error.

Traceback (most recent call last):
  File "/create-pull-request.py", line 134, in <module>
    if not ignore_event(github_event):
  File "/create-pull-request.py", line 33, in ignore_event
    deleted = "{deleted}".format(**github_event)
KeyError: 'deleted'
##[error]Docker run failed with exit code 1

diff with existing branch not detected

Hi Peter,

I'm facing the issue that changes after the initial commit are not recognized as such.

My use case is a reformatting of the codebase and pushing it into a PR.
If the codebase changes and the PR has not yet been merged, an update of the existing PR seems to be appropriate, so I'm using the branch-suffix: none option here.
However, new changes from the master branch are not correctly detected. My guess is that the checkout of the master branch makes the local branch "undirty" by discarding changes on the rebase or merge. The two branches are definitely different but not detected. As a result, the existing PR is shown with conflicts.

An alternative option would be a force push. The commits themselves only include changes. If other files are affected so that there would be no conflict, the commits won't change, are thus equal and do not need to be pushed. A force push has the advantage that there is only one commit to compare against. Either that commit is different or it is not.

Here my log:

Currently checked out base assumed to be branch 'master'
Pull request branch to create/update set to 'black'
Pull request branch 'black' already exists as remote branch 'origin/black'
Checking out branch 'black'
Checking for local working copy changes indicating a diff with existing pull request branch 'origin/black' # local black and origin/black are different
No modified or untracked files detected. Skipping.

Here is the PR and the action.

Update body when PR exists

Thanks for developing this action, works great!

I was wondering if it would be possible to update the PR body when the branch exists already. To simplify review, I add some details about the commit to the PR's body, but when it gets updated with a different commit that information is out-of-sync.

fatal: could not read Username for 'https://github.com': Device not configured

Create-pull-request throws error

I am running a job using github actions on my repo (see www.github.com/lindanab/me_neo/actions) and use create-pull-request to provoke a pull request after the job has run. The pull request seems to throw an error when the job exceeds 1 hour:

Compare for example:
https://github.com/lindanab/me_neo/actions/runs/62244781 (did run),
and
https://github.com/LindaNab/me_neo/actions/runs/62443469 (failed),
while https://github.com/LindaNab/me_neo/blob/master/.github/workflows/main.yml has not changed.

The error is:
Pull request branch to create or update set to 'patch'
Supplied committer will also be used as the author.
Configured git committer as 'Linda Nab [email protected]'
Configured git author as 'Linda Nab [email protected]'
Uncommitted changes found. Adding a commit.
Traceback (most recent call last):
File "/Users/runner/runners/2.165.2/work/_actions/peter-evans/create-pull-request/v2/dist/cpr/create_pull_request.py", line 191, in
result = coub.create_or_update_branch(repo, repo_url, commit_message, base, branch)
File "/Users/runner/runners/2.165.2/work/_actions/peter-evans/create-pull-request/v2/dist/cpr/create_or_update_branch.py", line 70, in create_or_update_branch
repo.git.fetch("--force", repo_url, f"{working_base}:{working_base}")
File "/Users/runner/hostedtoolcache/Python/3.8.2/x64/lib/python3.8/site-packages/git/cmd.py", line 542, in
return lambda *args, **kwargs: self._call_process(name, *args, **kwargs)
File "/Users/runner/hostedtoolcache/Python/3.8.2/x64/lib/python3.8/site-packages/git/cmd.py", line 1005, in _call_process
return self.execute(call, **exec_kwargs)
File "/Users/runner/hostedtoolcache/Python/3.8.2/x64/lib/python3.8/site-packages/git/cmd.py", line 822, in execute
raise GitCommandError(command, status, stderr_value, stdout_value)
git.exc.GitCommandError: Cmd('git') failed due to: exit code(128)
cmdline: git -c http.https://github.com/.extraheader=AUTHORIZATION: basic *** fetch --force https://github.com/LindaNab/me_neo master:master
stderr: 'fatal: could not read Username for 'https://github.com': Device not configured'
##[error]The process '/Users/runner/hostedtoolcache/Python/3.8.2/x64/bin/python' failed with exit code 1

Can't use action with alpine container

When using this action in a job using an alpine container, the action fails.

/usr/bin/docker exec  a9bf6e9e8c37820f154e50cbf7d4208a10d384c7a86ac34c05965fdff55f83e0 sh -c "cat /etc/*release | grep ^ID"
Container distribution is alpine. Running JavaScript Action with external tool: node12_alpine
/__t/Python/3.8.1/x64/bin/pip install --requirement /__w/_actions/peter-evans/create-pull-request/master/dist/src/requirements.txt --no-index --find-links=/__w/_actions/peter-evans/create-pull-request/master/dist/vendor
##[error]There was an error when attempting to execute the process '/__t/Python/3.8.1/x64/bin/pip'. This may indicate the process failed to start. Error: spawn /__t/Python/3.8.1/x64/bin/pip ENOENT
##[error]Node run failed with exit code 1

Download artifiacts, -- local can only run in git repository error

Subject of the issue

I have an action that uploads a whole git repository and then downloads it for creating a PR. However, the create-pr bot gives an error:

/usr/bin/git config --local --name-only --get-regexp http.https://github.com/.extraheader ^AUTHORIZATION:
fatal: --local can only be used inside a git repository
/opt/hostedtoolcache/Python/3.8.2/x64/bin/python /home/runner/work/_actions/peter-evans/create-pull-request/v2/dist/cpr/create_pull_request.py
Traceback (most recent call last):
  File "/home/runner/work/_actions/peter-evans/create-pull-request/v2/dist/cpr/create_pull_request.py", line 116, in <module>
    repo = Repo(path)
  File "/opt/hostedtoolcache/Python/3.8.2/x64/lib/python3.8/site-packages/git/repo/base.py", line 181, in __init__
    raise InvalidGitRepositoryError(epath)
git.exc.InvalidGitRepositoryError: /home/runner/work/Example.jl/Example.jl
##[error]The process '/opt/hostedtoolcache/Python/3.8.2/x64/bin/python' failed with exit code 1

Steps to reproduce

https://github.com/aminya/Example.jl/actions/runs/81369735

The artifacts has the whole repo: https://github.com/aminya/Example.jl/suites/608063252/artifacts/4598275

force-push performed with `github-actions` bot's token

Force-push was done with a different token than provided

The workflow file that created the PR: https://github.com/AnySoftKeyboard/AnySoftKeyboard/blob/master/.github/workflows/localization_update.yml
I'm using a personal token for the user https://github.com/anysoftkeyboard-bot

The PR and commit were created with the right user. And PR checks ran.

Later, the workflow ran again and this time github-actions force-pushed.
Screen Shot 2020-02-16 at 10 12 21 PM

AnySoftKeyboard/AnySoftKeyboard#2057

Create commit in the current pull request

Is it possible to append the changes with a new commit to the current PR instead of opening a separate PR?

I would use this kind of workflow based on a comment event, when certain keywords are used

Use of team-reviewers results in: "Could not resolve to a node with the global id of..." error

Subject of the issue

Providing a GitHub team to request a review from doesn't work.

Steps to reproduce

    - name: Push changes to Github and create pull request
      if: ${{ env.CREATE_PR == 1 }}
      id: pull_request
      uses: peter-evans/create-pull-request@v2
      with:
        token: ${{ secrets.GITHUB_TOKEN }}
        title: 'Some text here...'
        body: |
          Some text here...
          - Some text here...
          - Auto-generated by [create-pull-request][1]

          [1]: https://github.com/peter-evans/create-pull-request
        labels: binupdate, automated pr
        team-reviewers: developers
        branch: binbase/update
        branch-suffix: timestamp

In the example above, developers is a valid Github team. When I base64 decode MDQ6VGVhbTE3NTI3NjE= in the error below, it resolves to: 04:Team1752761 and I can confirm that 1752761 is the correct id for our developers Github team.

The error message we see is:

Requesting team reviewers 'developers'
Traceback (most recent call last):
  File "/home/runner/work/_actions/peter-evans/create-pull-request/v2/dist/cpr/create_pull_request.py", line 213, in <module>
    coupr.create_or_update_pull_request(
  File "/home/runner/work/_actions/peter-evans/create-pull-request/v2/dist/cpr/create_or_update_pull_request.py", line 143, in create_or_update_pull_request
    pull_request.create_review_request(
  File "/opt/hostedtoolcache/Python/3.8.2/x64/lib/python3.8/site-packages/github/PullRequest.py", line 511, in create_review_request
    headers, data = self._requester.requestJsonAndCheck(
  File "/opt/hostedtoolcache/Python/3.8.2/x64/lib/python3.8/site-packages/github/Requester.py", line 317, in requestJsonAndCheck
    return self.__check(
  File "/opt/hostedtoolcache/Python/3.8.2/x64/lib/python3.8/site-packages/github/Requester.py", line 342, in __check
    raise self.__createException(status, responseHeaders, output)
github.GithubException.GithubException: 422 {"message": "Validation Failed", "errors": ["Could not resolve to a node with the global id of 'MDQ6VGVhbTE3NTI3NjE='."], "documentation_url": "https://developer.github.com/v3/pulls/review_requests/#create-a-review-request"}
##[error]The process '/opt/hostedtoolcache/Python/3.8.2/x64/bin/python' failed with exit code 1
/usr/bin/git config --local --add http.https://github.com/.extraheader AUTHORIZATION: basic ***

method to override branch to diff against when triggering on a branch push?

I added a specific branch I could push to trigger create-pull-request in my workflow: https://github.com/jmhodges/goreleaseapi/blob/168a1125ece9291a2fb3478e8759abe5af35a4fd/.github/workflows/rebuild_api.yml

So, it seems that create-pull-request will diff against the branch it was pushed into (makes sense!) instead of, say, master. (Unless my configuration is wrong in a way I've missed!)

It'd be nice if I could override the branch that c-p-r diffs against so I can merge in the PRs that it makes from a push to a specific testing branch.

(Or maybe I missed that feature somewhere already?)

[V1] No matching distribution found for GitPython===3.0.5

Subject of the issue

I am using create-pull-request@v1. Until yesterday evening, it works just fine.

Before

Starting from today, suddenly I got error: No matching distribution found for GitPython===3.0.5.

After

Any idea on how to solve this? I didn't change any config from my part and already try to rerun the action πŸ™‡ Is it expected for me to use v2 instead?

Support push using ssh

To get around #48, would be great if create-pull-request could support push using ssh.
It is more secure than using a personal token because it can be set for each repository.

'fatal: ref HEAD is not a symbolic ref' errors

Since recently, this action here fails for me when running on pull requests. Unfortunately, I don't have a public repo right now that shows the issue, but here's an abridged log:

2020-04-23T17:09:27.7823345Z ##[section]Starting: Request a runner to run this job
2020-04-23T17:09:28.5456831Z Requesting a hosted runner in current repository's account/organization with labels: 'ubuntu-18.04', require runner match: True
2020-04-23T17:09:28.6447249Z Labels matched hosted runners has been found, waiting for one of them get assigned for this job.
2020-04-23T17:09:28.6990438Z ##[section]Finishing: Request a runner to run this job
2020-04-23T17:09:36.5752069Z Current runner version: '2.169.1'
2020-04-23T17:09:36.5776942Z ##[group]Operating System
2020-04-23T17:09:36.5778351Z Ubuntu
2020-04-23T17:09:36.5779270Z 18.04.4
2020-04-23T17:09:36.5780112Z LTS
2020-04-23T17:09:36.5780972Z ##[endgroup]
2020-04-23T17:09:36.5781847Z ##[group]Virtual Environment
2020-04-23T17:09:36.5782750Z Environment: ubuntu-18.04
2020-04-23T17:09:36.5783608Z Version: 20200406.2
2020-04-23T17:09:36.5784724Z Included Software: https://github.com/actions/virtual-environments/blob/ubuntu18/20200406.2/images/linux/Ubuntu1804-README.md
2020-04-23T17:09:36.5785818Z ##[endgroup]
2020-04-23T17:09:36.5787429Z Prepare workflow directory
2020-04-23T17:09:36.5981421Z Prepare all required actions
2020-04-23T17:09:36.5997277Z Download action repository 'actions/checkout@v2'
2020-04-23T17:09:37.5055896Z Download action repository 'peter-evans/[email protected]'
...
2020-04-23T17:09:46.7064186Z ##[group]Run actions/checkout@v2
2020-04-23T17:09:46.7064895Z with:
2020-04-23T17:09:46.7065552Z   repository: xxx
2020-04-23T17:09:46.7066267Z   token: ***
2020-04-23T17:09:46.7067258Z   ssh-strict: true
2020-04-23T17:09:46.7067785Z   persist-credentials: true
2020-04-23T17:09:46.7068317Z   clean: true
2020-04-23T17:09:46.7068842Z   fetch-depth: 1
2020-04-23T17:09:46.7069367Z   lfs: false
2020-04-23T17:09:46.7069894Z   submodules: false
2020-04-23T17:09:46.7070427Z ##[endgroup]
2020-04-23T17:09:47.1399028Z Syncing repository: xxx
2020-04-23T17:09:47.1480498Z ##[group]Getting Git version info
2020-04-23T17:09:47.1481767Z Working directory is '/home/runner/work/xxx/xxx'
2020-04-23T17:09:47.1524442Z [command]/usr/bin/git version
2020-04-23T17:09:47.1664800Z git version 2.26.0
2020-04-23T17:09:47.1692902Z ##[endgroup]
2020-04-23T17:09:47.1701772Z Deleting the contents of '/home/runner/work/xxx/xxx'
2020-04-23T17:09:47.1704754Z ##[group]Initializing the repository
2020-04-23T17:09:47.1708714Z [command]/usr/bin/git init /home/runner/work/xxx/xxx
2020-04-23T17:09:47.1804047Z Initialized empty Git repository in /home/runner/work/xxx/xxx/.git/
2020-04-23T17:09:47.1815909Z [command]/usr/bin/git remote add origin https://github.com/xxx/xxx
2020-04-23T17:09:47.1860816Z ##[endgroup]
2020-04-23T17:09:47.1861665Z ##[group]Disabling automatic garbage collection
2020-04-23T17:09:47.1867242Z [command]/usr/bin/git config --local gc.auto 0
2020-04-23T17:09:47.1898144Z ##[endgroup]
2020-04-23T17:09:47.1903941Z ##[group]Setting up auth
2020-04-23T17:09:47.1912123Z [command]/usr/bin/git config --local --name-only --get-regexp core\.sshCommand
2020-04-23T17:09:47.1945688Z [command]/usr/bin/git submodule foreach --recursive git config --local --name-only --get-regexp 'core\.sshCommand' && git config --local --unset-all 'core.sshCommand' || :
2020-04-23T17:09:47.2343142Z [command]/usr/bin/git config --local --name-only --get-regexp http\.https\:\/\/github\.com\/\.extraheader
2020-04-23T17:09:47.2412984Z [command]/usr/bin/git submodule foreach --recursive git config --local --name-only --get-regexp 'http\.https\:\/\/github\.com\/\.extraheader' && git config --local --unset-all 'http.https://github.com/.extraheader' || :
2020-04-23T17:09:47.2689438Z [command]/usr/bin/git config --local http.https://github.com/.extraheader AUTHORIZATION: basic ***
2020-04-23T17:09:47.2740998Z ##[endgroup]
2020-04-23T17:09:47.2741945Z ##[group]Fetching the repository
2020-04-23T17:09:47.2749971Z [command]/usr/bin/git -c protocol.version=2 fetch --no-tags --prune --progress --no-recurse-submodules --depth=1 origin +9e9c4726262fb6e432e840572fe5e872b7277876:refs/remotes/pull/112/merge
2020-04-23T17:09:47.6017498Z remote: Enumerating objects: 231, done.        
...   
2020-04-23T17:09:47.6330272Z remote: Compressing objects: 100% (205/205), done.        
...
2020-04-23T17:09:47.6657662Z remote: Total 231 (delta 36), reused 87 (delta 7), pack-reused 0        
...
2020-04-23T17:09:47.7117282Z From https://github.com/xxx/xxx
2020-04-23T17:09:47.7118266Z  * [new ref]         9e9c4726262fb6e432e840572fe5e872b7277876 -> pull/112/merge
2020-04-23T17:09:47.7151923Z ##[endgroup]
2020-04-23T17:09:47.7152818Z ##[group]Determining the checkout info
2020-04-23T17:09:47.7156578Z ##[endgroup]
2020-04-23T17:09:47.7157308Z ##[group]Checking out the ref
2020-04-23T17:09:47.7164529Z [command]/usr/bin/git checkout --progress --force refs/remotes/pull/112/merge
2020-04-23T17:09:47.7362273Z Note: switching to 'refs/remotes/pull/112/merge'.
2020-04-23T17:09:47.7363209Z 
2020-04-23T17:09:47.7364362Z You are in 'detached HEAD' state. You can look around, make experimental
2020-04-23T17:09:47.7365096Z changes and commit them, and you can discard any commits you make in this
2020-04-23T17:09:47.7365778Z state without impacting any branches by switching back to a branch.
2020-04-23T17:09:47.7366157Z 
2020-04-23T17:09:47.7366821Z If you want to create a new branch to retain commits you create, you may
2020-04-23T17:09:47.7367685Z do so (now or later) by using -c with the switch command. Example:
2020-04-23T17:09:47.7368057Z 
2020-04-23T17:09:47.7368717Z   git switch -c <new-branch-name>
2020-04-23T17:09:47.7369007Z 
2020-04-23T17:09:47.7369523Z Or undo this operation with:
2020-04-23T17:09:47.7369795Z 
2020-04-23T17:09:47.7370423Z   git switch -
2020-04-23T17:09:47.7370702Z 
2020-04-23T17:09:47.7371252Z Turn off this advice by setting config variable advice.detachedHead to false
2020-04-23T17:09:47.7371671Z 
2020-04-23T17:09:47.7372336Z HEAD is now at 9e9c472 Merge fe9a2a8d7a4900aa0b5b8818146a0f9e6c6d6435 into 51e51976e0aefa42064f9777002a94ae9fd48f8f
2020-04-23T17:09:47.7374627Z ##[endgroup]
2020-04-23T17:09:47.7375604Z [command]/usr/bin/git log -1
2020-04-23T17:09:47.7405277Z commit 9e9c4726262fb6e432e840572fe5e872b7277876
...
2020-04-23T17:09:52.1943490Z ##[group]Run peter-evans/[email protected]
2020-04-23T17:09:52.1944116Z with:
2020-04-23T17:09:52.1945374Z   token: ***
2020-04-23T17:09:52.1945916Z   title: xxx
2020-04-23T17:09:52.1946538Z   branch: xxx/refs/pull/112/merge
2020-04-23T17:09:52.1948425Z   body: Please merge these changes into the refs/pull/112/merge branch
2020-04-23T17:09:52.1949230Z   commit-message: xxx
2020-04-23T17:09:52.1949939Z ##[endgroup]
2020-04-23T17:09:52.2571784Z [command]/opt/hostedtoolcache/Python/3.8.2/x64/bin/pip install --requirement /home/runner/work/_actions/peter-evans/create-pull-request/v2.2.0/dist/src/requirements.txt --no-index --find-links=/home/runner/work/_actions/peter-evans/create-pull-request/v2.2.0/dist/vendor
2020-04-23T17:09:52.8306694Z Looking in links: /home/runner/work/_actions/peter-evans/create-pull-request/v2.2.0/dist/vendor
2020-04-23T17:09:52.8391757Z Processing /home/runner/work/_actions/peter-evans/create-pull-request/v2.2.0/dist/vendor/GitPython-3.0.5.tar.gz
2020-04-23T17:09:53.0998662Z Processing /home/runner/work/_actions/peter-evans/create-pull-request/v2.2.0/dist/vendor/PyGithub-1.45.tar.gz
2020-04-23T17:09:53.3511870Z Processing /home/runner/work/_actions/peter-evans/create-pull-request/v2.2.0/dist/vendor/gitdb2-2.0.6.tar.gz
2020-04-23T17:09:53.5630600Z Processing /home/runner/work/_actions/peter-evans/create-pull-request/v2.2.0/dist/vendor/Deprecated-1.2.7.tar.gz
2020-04-23T17:09:53.8512874Z Processing /home/runner/work/_actions/peter-evans/create-pull-request/v2.2.0/dist/vendor/PyJWT-1.7.1.tar.gz
2020-04-23T17:09:54.0831673Z Processing /home/runner/work/_actions/peter-evans/create-pull-request/v2.2.0/dist/vendor/requests-2.22.0.tar.gz
2020-04-23T17:09:54.3654746Z Processing /home/runner/work/_actions/peter-evans/create-pull-request/v2.2.0/dist/vendor/six-1.14.0.tar.gz
2020-04-23T17:09:54.5719792Z Processing /home/runner/work/_actions/peter-evans/create-pull-request/v2.2.0/dist/vendor/smmap2-2.0.5.tar.gz
2020-04-23T17:09:54.7827169Z Processing /home/runner/work/_actions/peter-evans/create-pull-request/v2.2.0/dist/vendor/wrapt-1.11.2.tar.gz
2020-04-23T17:09:54.9964586Z Processing /home/runner/work/_actions/peter-evans/create-pull-request/v2.2.0/dist/vendor/chardet-3.0.4.tar.gz
2020-04-23T17:09:55.3726962Z Processing /home/runner/work/_actions/peter-evans/create-pull-request/v2.2.0/dist/vendor/idna-2.8.tar.gz
2020-04-23T17:09:55.5787565Z Processing /home/runner/work/_actions/peter-evans/create-pull-request/v2.2.0/dist/vendor/urllib3-1.25.8.tar.gz
2020-04-23T17:09:55.8386183Z Processing /home/runner/work/_actions/peter-evans/create-pull-request/v2.2.0/dist/vendor/certifi-2019.11.28.tar.gz
2020-04-23T17:09:56.0590651Z Installing collected packages: smmap2, gitdb2, GitPython, wrapt, deprecated, pyjwt, chardet, idna, urllib3, certifi, requests, six, PyGithub
2020-04-23T17:09:56.0598760Z     Running setup.py install for smmap2: started
2020-04-23T17:09:56.2970406Z     Running setup.py install for smmap2: finished with status 'done'
2020-04-23T17:09:56.3000143Z     Running setup.py install for gitdb2: started
2020-04-23T17:09:56.5553330Z     Running setup.py install for gitdb2: finished with status 'done'
2020-04-23T17:09:56.5582759Z     Running setup.py install for GitPython: started
2020-04-23T17:09:56.9240652Z     Running setup.py install for GitPython: finished with status 'done'
2020-04-23T17:09:56.9294468Z     Running setup.py install for wrapt: started
2020-04-23T17:09:58.0531960Z     Running setup.py install for wrapt: finished with status 'done'
2020-04-23T17:09:58.0555469Z     Running setup.py install for deprecated: started
2020-04-23T17:09:58.3015651Z     Running setup.py install for deprecated: finished with status 'done'
2020-04-23T17:09:58.3042480Z     Running setup.py install for pyjwt: started
2020-04-23T17:09:58.5453811Z     Running setup.py install for pyjwt: finished with status 'done'
2020-04-23T17:09:58.5470331Z     Running setup.py install for chardet: started
2020-04-23T17:09:58.9414728Z     Running setup.py install for chardet: finished with status 'done'
2020-04-23T17:09:58.9464107Z     Running setup.py install for idna: started
2020-04-23T17:09:59.2594002Z     Running setup.py install for idna: finished with status 'done'
2020-04-23T17:09:59.2615865Z     Running setup.py install for urllib3: started
2020-04-23T17:09:59.5686483Z     Running setup.py install for urllib3: finished with status 'done'
2020-04-23T17:09:59.5728440Z     Running setup.py install for certifi: started
2020-04-23T17:09:59.7938223Z     Running setup.py install for certifi: finished with status 'done'
2020-04-23T17:09:59.7957545Z     Running setup.py install for requests: started
2020-04-23T17:10:00.0969154Z     Running setup.py install for requests: finished with status 'done'
2020-04-23T17:10:00.1007396Z     Running setup.py install for six: started
2020-04-23T17:10:00.3379142Z     Running setup.py install for six: finished with status 'done'
2020-04-23T17:10:00.3397582Z     Running setup.py install for PyGithub: started
2020-04-23T17:10:00.7214334Z     Running setup.py install for PyGithub: finished with status 'done'
2020-04-23T17:10:00.7537743Z Successfully installed GitPython-3.0.5 PyGithub-1.45 certifi-2019.11.28 chardet-3.0.4 deprecated-1.2.7 gitdb2-2.0.6 idna-2.8 pyjwt-1.7.1 requests-2.22.0 six-1.14.0 smmap2-2.0.5 urllib3-1.25.8 wrapt-1.11.2
2020-04-23T17:10:00.8228041Z [command]/opt/hostedtoolcache/Python/3.8.2/x64/bin/python /home/runner/work/_actions/peter-evans/create-pull-request/v2.2.0/dist/src/create_pull_request.py
2020-04-23T17:10:01.0692548Z   stderr: 'fatal: ref HEAD is not a symbolic ref'
2020-04-23T17:10:01.0696093Z ##[error]The checked out ref is not a valid base for a pull request. Unable to continue. Exiting.
2020-04-23T17:10:01.0979351Z ##[error]The process '/opt/hostedtoolcache/Python/3.8.2/x64/bin/python' failed with exit code 1

I am suspecting this might have something to do with changes in the actions/checkout@v2 action made at the end of last year, see here:

actions/checkout#23

In particular, this comment says

V2 fetches a specific SHA and retries with a few delays between before failing. Whereas V1 fetched the merge PR ref.

I don't know enough about git internals to fully understand this, but it sounds as if the actions/checkout action now always leaves us in detached head state on a SHA instead of being checked out on something that feels like a branch.

Not sure if here is the right place to fix this (or if it can be fixed), but I guess actions/checkout is such a central thing that they knew what and why they were doing it that way.

Use case: keeping a branch up-to-date with another

Great project, thanks. I was wondering if it can fulfill the use case of keeping a branch up-to-date with another (without adding new commits or branches). Along the lines of https://github.com/repo-sync/pull-request but I found your project much more advanced so I'd prefer to use it. AFAICT this boils down to a small feature request, but I'd explain my use case just to make sure.

Ideally, I'd like the following:

  • upon new commits in a base branch (e.g. master) there's a PR opened to target branches (e.g. staging, production)
  • there's a single automated PR from base to a target branch
  • if the target branch is updated, this PR is kept up-to-date (e.g. closed)
  • there can be any number of manually created PRs between the base and deploy branches that will not be affected

I think in theory this could work. In my example, I'd run this action on master, set the PR base (base) to my production branch. The concern/request I have is the ability to set branch to master using Strategy A but make it so that it's not deleted, even after merging the PR.

If subsequent changes cause the branch to no longer differ from the base the pull request will be automatically closed and the branch deleted.

In the default context, it makes sense to delete a merged PR's branch. I can see 2 ways my use case could be supported:

  • if branch wasn't created by this action, it should not be deleted by default
  • an optional input to not delete the branch

Poor interaction with force-pushed branches

First off, thanks a lot for this project β€” it's already saving us a ton of time πŸ˜„

We ran into an issue when using BRANCH_SUFFIX: none in conjunction with workflows (human, not Github's...) that involve force-pushed feature branches. The general setup for reproduction is:

  • a PR (e.g., in a cron schedule) is generated from a feature branch, but not merged
  • the feature branch is force-pushed to something else
  • the cron runs again, and tries to update the unmerged PR branch
  • create-pull-request fails with something resembling:
Traceback (most recent call last):
  File "/create-pull-request.py", line 205, in <module>
    process_event(event_name, event_data, repo, branch, base, remote_exists)
  File "/create-pull-request.py", line 122, in process_event
    push_result = push_changes(repo.git, remote_exists, branch, commit_message)
  File "/create-pull-request.py", line 79, in push_changes
    git.rebase('-Xtheirs', '-')
  File "/usr/lib/python3.7/site-packages/git/cmd.py", line 545, in <lambda>
    return lambda *args, **kwargs: self._call_process(name, *args, **kwargs)
  File "/usr/lib/python3.7/site-packages/git/cmd.py", line 1014, in _call_process
    return self.execute(call, **exec_kwargs)
  File "/usr/lib/python3.7/site-packages/git/cmd.py", line 825, in execute
    raise GitCommandError(command, status, stderr_value, stdout_value)
git.exc.GitCommandError: Cmd('git') failed due to: exit code(1)
  cmdline: git rebase -Xtheirs -
  stderr: 'Rebasing (1/1)
interactive rebase in progress; onto bda5c319
The previous cherry-pick is now empty, possibly due to conflict resolution.
If you wish to commit it anyway, use:

    git commit --allow-empty

Otherwise, please use 'git reset'
Last command done (1 command done):
   pick 875113bb i18n: update translations from Crowdin

No commands remaining.
You are currently rebasing branch 'update-i18n' on 'bda5c319'.

no changes added to commit
Could not apply 875113bb... i18n: update translations from Crowdin'

(This is a real example, taken from here.)

The produced error message is not entirely helpful in deducing the underlying issue. While I'm unsure of what better behaviour would be, I figured I would file this in case someone else runs into it πŸ˜‰

git.exc.InvalidGitRepositoryError with wrong repo directory

 Downloading https://files.pythonhosted.org/packages/b9/63/df50cac98ea0d5b006c55a399c3bf1db9da7b5a24de7890bc9cfd5dd9e99/certifi-2019.11.28-py2.py3-none-any.whl (156kB)
Collecting urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1
  Downloading https://files.pythonhosted.org/packages/b4/40/a9837291310ee1ccc242ceb6ebfd9eb21539649f193a7c8c86ba15b98539/urllib3-1.25.7-py2.py3-none-any.whl (125kB)
Collecting chardet<3.1.0,>=3.0.2
  Downloading https://files.pythonhosted.org/packages/bc/a9/01ffebfb562e4274b6487b4bb1ddec7ca55ec7510b22e4c51f14098443b8/chardet-3.0.4-py2.py3-none-any.whl (133kB)
Collecting idna<2.9,>=2.5
  Downloading https://files.pythonhosted.org/packages/14/2c/cd551d81dbe15200be1cf41cd03869a46fe7226e7450af7a6545bfc474c9/idna-2.8-py2.py3-none-any.whl (58kB)
Installing collected packages: smmap2, gitdb2, GitPython, wrapt, deprecated, pyjwt, certifi, urllib3, chardet, idna, requests, six, PyGithub
    Running setup.py install for wrapt: started
    Running setup.py install for wrapt: finished with status 'done'
    Running setup.py install for PyGithub: started
    Running setup.py install for PyGithub: finished with status 'done'
Successfully installed GitPython-3.0.5 PyGithub-1.44.1 certifi-2019.11.28 chardet-3.0.4 deprecated-1.2.7 gitdb2-2.0.6 idna-2.8 pyjwt-1.7.1 requests-2.22.0 six-1.13.0 smmap2-2.0.5 urllib3-1.25.7 wrapt-1.11.2
python /home/runner/work/_actions/peter-evans/create-pull-request/v1/dist/src/create-pull-request.py
Traceback (most recent call last):
  File "/home/runner/work/_actions/peter-evans/create-pull-request/v1/dist/src/create-pull-request.py", line 233, in <module>
    repo = Repo(os.getcwd())
  File "/opt/hostedtoolcache/Python/3.8.0/x64/lib/python3.8/site-packages/git/repo/base.py", line 184, in __init__
    raise InvalidGitRepositoryError(epath)
git.exc.InvalidGitRepositoryError: /home/runner/work/react-ui/react-ui

I got the above error when trying to trigger the action.

I think this is related to this issue.

gitpython-developers/GitPython#255

Which can be fixed by changing this line.
https://github.com/peter-evans/create-pull-request/blob/master/src/create-pull-request.py#L233

Creating a single pull request for different OS

Subject of the issue

Creating a single pull request for different OS

Steps to reproduce

Is it possible to create a single PR for different OS?

I have a workflow file like this:
https://github.com/aminya/Example.jl/blob/017d772f3b36e50a32913c7d0d76e72f3fa849db/.github/workflows/SnoopCompileMulti.yml#L34
that generates separate PRs for different OS. I want to know if I can merge these two together (they don't have conflicts).

Ref. timholy/SnoopCompile.jl#71

Container action is only supported on Linux

This action only works on linux due to it using a docker container.
Would be good if this action could work for Mac OSX and Windows too, but I guess this would mean moving away from a docker implementation.
At very least (although does not work for me) call this out in the README that only Linux is supported.

Support custom checkout path

The actions/checkout task allows you to specify a custom checkout path relative to the workspace. Would be great if create-pull-request could support that.

Flag to stop the branch deletion when branches match (mostly for gh-pages)

Subject of the issue

Great Script! I'm using this script to branch from master to gh-pages automatically.

When they match the script try's to blow away the gh-pages directory, but that is where github pages are served from. Ideally some flag that we could set to prevent:

Branch 'gh-pages' no longer differs from base branch 'master'
Closing pull request and deleting branch 'gh-pages'

Steps to reproduce

name: Create Thumbnails, Compressed images, Build Jekyll Site, Branch to Release on Success
env:
  URL: "example.com"
  AutoMergeLabel: "automerge"
  GHPages: "gh-pages"
  CurrentBranch: "master"
  Repo: "repo"
  Owner: "owner"
  # https://help.github.com/en/actions/configuring-and-managing-workflows/using-environment-variables#default-environment-variables

on:
  push:
    branches: [master]
# page_build: # Pretty sure this was triggering endlessly
  pull_request:
    paths:
      - '**.jpg'
      - '**.jpeg'
      - '**.png'
      - '**.webp'

jobs:
  process_images:
    name: Process Images with DotNet ${{ matrix.dotnet }}
    runs-on: [windows-latest]
    strategy:
      matrix:
        dotnet: [ '3.1.100' ]
    steps:
      - name: Checkout
        uses: actions/checkout@v2
        with:
          path: main 
      - name: Checkout Image Tools
        uses: actions/checkout@v2
        with:
          repository: pauliver/CSharp-Image-Action
          path: ImgTools
        
      - name: Setup dotnet
        uses: actions/setup-dotnet@v1
        with:
          dotnet-version: ${{ matrix.dotnet }}
     
      - name: Restore Dependancies
        run: dotnet restore ImgTools/

      - name: Build Image Tools
        run: dotnet build ImgTools/ --configuration Release
      
      - name: Run the Image Tools
        run: dotnet  ${{github.workspace}}\ImgTools\bin\Release\netcoreapp3.1\CSharp-Image-Action.dll  ${{github.workspace}}\main\gallery\ ${{github.workspace}}\main\ https://${{env.URL}}

      - name: Commit the resized files and .json
        run: |
          git config --local user.email "[email protected]"
          git config --local user.name "GitHub Action"
          git add *
          git commit -m "Add resized images" -a
        working-directory: main 
        shell: powershell
      - name: Push changes
        uses: ad-m/github-push-action@master
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          directory: main   
  build_jekyll_site:
    name: Build the site in the jekyll/builder container
    needs: process_images
    runs-on: [ubuntu-latest]
    strategy:
      matrix:
        dotnet: [ '3.1.100' ]
    steps:
      - name: Checkout
        uses: actions/checkout@v2
      - run: |
          docker run \
          -v ${{ github.workspace }}:/srv/jekyll -v ${{ github.workspace }}/_site:/srv/jekyll/_site \
          jekyll/builder:latest /bin/bash -c "chmod 777 /srv/jekyll && jekyll build --future"
  create_pr_if_success:
    name: Create PR to gh-pages if everything works
    needs: [process_images, build_jekyll_site]
    runs-on: [ubuntu-latest]
    strategy:
      matrix:
        dotnet: [ '3.1.100' ]
    steps:
      - name: Checkout
        uses: actions/checkout@v2
        with:
          path: main
      - name: Create Pull Request
        uses: peter-evans/[email protected] #https://github.com/marketplace/actions/create-pull-request
        with:
          path: main
          base: ${{env.CurrentBranch}}
          branch: ${{env.GHPages}}
          token: ${{ secrets.GITHUB_TOKEN }}
          commit-message: "tests all passed, creating PR for ${{env.GHPages}}"
          labels: ${{env.AutoMergeLabel}}

PRs created don't trigger other actions

It seems that any PRs that get created by this action will not trigger any actions waiting on a pull request event, which means that you can have any required status checks.

Any ideas for how to get around this?

Create PR on Schedule (like every monday 8:00 am)

Can we create a new PR from specific branch on schedule?
My requirement is need to create auto PR from develop to master on every week/specific day.

on:
  schedule:
    - cron: '0 8 * * MON'
jobs:
  createPullRequest:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Create Pull Request
        id: cpr
        uses: peter-evans/create-pull-request@v2.4.4
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
          commit-message: Merge development to master
          title: '[Example] Add report file'
          body: |
            Auto-generated PR to make sure our `master` branch should have the latest code 
          labels: ready for review
          assignees: JigarM
          reviewers: JigarM
          branch: develop

fatal: --local can only be used inside a git repository

Subject of the issue

I'm trying to automatically add a pull request when a certain set of branches are updated. However, my workflow is throwing this exception:

Successfully installed GitPython-3.0.8 PyGithub-1.46 certifi-2019.11.28 chardet-3.0.4 deprecated-1.2.7 gitdb2-3.0.2 idna-2.9 pyjwt-1.7.1 requests-2.23.0 smmap2-2.0.5 urllib3-1.25.8 wrapt-1.12.0
/usr/bin/git config --local --name-only --get-regexp http.https://github.com/.extraheader ^AUTHORIZATION:
fatal: --local can only be used inside a git repository
/opt/hostedtoolcache/Python/3.8.2/x64/bin/python /home/runner/work/_actions/peter-evans/create-pull-request/v2/dist/cpr/create_pull_request.py
Traceback (most recent call last):
  File "/home/runner/work/_actions/peter-evans/create-pull-request/v2/dist/cpr/create_pull_request.py", line 116, in <module>
    repo = Repo(path)
  File "/opt/hostedtoolcache/Python/3.8.2/x64/lib/python3.8/site-packages/git/repo/base.py", line 181, in __init__
    raise InvalidGitRepositoryError(epath)
git.exc.InvalidGitRepositoryError: /home/runner/work/software/software
##[error]The process '/opt/hostedtoolcache/Python/3.8.2/x64/bin/python' failed with exit code 1

Steps to reproduce

The following workflow file was triggered by pushing to lokalise/de

on:
  push:
    branches:
      - 'lokalise/**'

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - name: Create pull request
        uses: peter-evans/create-pull-request@v2
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
          commit-message: ${{ github.head_ref }}
          title: ${{ github.head_ref }}
          body: This is an auto-generated PR that updates localization files
          branch: ${{ github.head_ref }}

fatal: ref HEAD is not a symbolic ref

Subject of the issue

ref HEAD is not a symbolic ref

Steps to reproduce

We are using your action to automatically open a pull request after changes have been made to some JS files which require building a bundle.

This is how we are using the action

      - name: Create Pull Request
        uses: peter-evans/create-pull-request@v2
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
          commit-message: "Auto compiled JS"
          title: "Auto compiled JS"
          body: "This pull request was automatically generated as new changes on the JS project were found"
          branch: "auto/javascript-compiled"
          branch-suffix: timestamp

In this particular case, we made a change and committed directly to master. This, in v1, worked well. Now in v2, we get the above error. We migrated to v2 because we were experiencing some python issues this morning and decided to upgrade.

Pushes performed by [email protected] despite scoped token

Related to issue #48, I specified a personal access token as GITHUB_TOKEN environment for the action. However, the pushes are still marked as being done by [email protected]..
Then, I cannot find a way to trigger other actions when an update is done to the PR this action, neither pull_request/synchronize, nor push/branches seem to work..
Any idea how to make working the push using the personal access token?

Here is the excerpt of configuration I use:

    - name: Create Pull Request
      uses: peter-evans/create-pull-request@v1
      env:
          GITHUB_TOKEN: ${{ secrets.PAT }}
      with:
        commit-message: "[auto] update tools"
        title: Automated update of tools
        body: This is an auto-generated PR with tool updates.
        labels: pkg-update, autodocker
        assignees: pauleve
        branch: auto/tool-updates
        branch-suffix: none

(the full action is here: https://github.com/colomoto/colomoto-docker/blob/master/.github/workflows/auto-update.yml)

Here is an example of PR which has been updated, but with pushes authored by [email protected]:
colomoto/colomoto-docker#41

[error]Working base branch '[branch name]' was created by this action. Unable to continue.

Why is it not possible to create PR with a working branch I created in same action?

name: Create and save OpenAPI specification files
# on: repository_dispatch
on:
  watch:
    types: [started]
jobs:
commit-files:
    name: Commit OpenAPI specification files
    needs: create-files
    runs-on: ubuntu-latest
    steps:
      - name: Download OpenAPI specification files from previous job
        uses: actions/download-artifact@v1
        with:
          name: spec-files
      - name: Get version number
        shell: bash
        run: |
          value=`cat spec-files/version.txt`
          echo ::set-output name=version::$value
        id: get-version
      - name: Get date
        shell: bash
        run: |
          echo ::set-output name=date::$(date '+%Y%m%d-%H%M')
        id: get-date
      - name: Create new branch
        uses: peterjgrainger/[email protected]
        env:
          GITHUB_TOKEN: ${{ secrets.GitHub_PAT }}
        with:
          branch: v${{ steps.get-version.outputs.version }}-${{ steps.get-date.outputs.date }}
      - name: Checkout OpenAPI specification files
        uses: actions/checkout@v2
        with:
          ref: v${{ steps.get-version.outputs.version }}-${{ steps.get-date.outputs.date }}
          token: ${{ secrets.GitHub_PAT }}
          path: repo
      - name: Copy files to src folder
        run: |
          rm -rf repo/src
          cp -r spec-files/*.json repo/src
      - name: Create Pull Request
        uses: peter-evans/create-pull-request@v2
        with:
          token: ${{ secrets.GitHub_PAT }}
          commit-message: Added new OpenAPI specification files v${{ steps.get-version.outputs.version }}-${{ steps.get-date.outputs.date }}
          committer: GitHub Action <[email protected]>
          author: GitHub Action <[email protected]>
          title: "[v${{ steps.get-version.outputs.version }}] Add new OpenAPI specification files ${{ steps.get-date.outputs.date }}"
          branch: v${{ steps.get-version.outputs.version }}-${{ steps.get-date.outputs.date }}
          path: repo

Error:

##[error]Working base branch 'v1.9.3-20200324-1447' was created by this action. Unable to continue. Exiting.
##[error]The process '/opt/hostedtoolcache/Python/3.8.2/x64/bin/python' failed with exit code 1

Authenticating with git extraheader causes error, possibly in combination with Git LFS

Subject of the issue

The latest commit breaks for us 289fda9

The stack trace is:

Traceback (most recent call last):
  File "/home/runner/work/_actions/peter-evans/create-pull-request/v2/dist/src/create_pull_request.py", line 196, in <module>
    repo.git.push("--force", repo_url, f"HEAD:refs/heads/{branch}")
  File "/opt/hostedtoolcache/Python/3.8.1/x64/lib/python3.8/site-packages/git/cmd.py", line 542, in <lambda>
    return lambda *args, **kwargs: self._call_process(name, *args, **kwargs)
  File "/opt/hostedtoolcache/Python/3.8.1/x64/lib/python3.8/site-packages/git/cmd.py", line 1005, in _call_process
    return self.execute(call, **exec_kwargs)
  File "/opt/hostedtoolcache/Python/3.8.1/x64/lib/python3.8/site-packages/git/cmd.py", line 822, in execute
    raise GitCommandError(command, status, stderr_value, stdout_value)
git.exc.GitCommandError: Cmd('git') failed due to: exit code(1)
  cmdline: git -c http.https://github.com/.extraheader=AUTHORIZATION: basic *** push --force <edited out> HEAD:refs/heads/create-pull-request/patch-1582181599
  stderr: 'batch response: Client error: <edited out>/info/lfs/objects/batch
error: failed to push some refs to '<edited out>''

Steps to reproduce

My GitHub action involves a Git LFS file which may be an added factor, not sure.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.