Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Understanding how this Action should be used #640

Closed
imsteev opened this issue Nov 20, 2020 · 2 comments
Closed

Understanding how this Action should be used #640

imsteev opened this issue Nov 20, 2020 · 2 comments

Comments

@imsteev
Copy link

imsteev commented Nov 20, 2020

Subject of the issue

Perhaps I misunderstood the API of this action, but it seems like there's some assumptions I made that does not align with how this workflow works.

My use case:

  • I want to create a PR from branch-B to branch-A, where branch-B simply contains commits on top of branch-A
    You can think of this as creating a PR from a development branch into production branch

What this means is that I don't intend on making any commits in the Workflow context itself, and simply want to create a PR

My configuration for this was along the lines of:

      - name: Create PR from upstream release branch
        uses: peter-evans/create-pull-request@v3
        with:
          branch: release-branch
          base: master
          token: ${{ secrets.TOKEN }}

but this quickly resulted in empty PRs that ended up not being opened because the Workflow attempts to rebase on top of master and thus does not detect that there are changes between branch and base, when in fact there are changes.

  Branch 'release-branch' is not ahead of base 'master' and will not be created

How can I use this Action given my use case above? Is it even possible?

Steps to reproduce

If this issue is describing a possible bug please provide (or link to) your GitHub Actions workflow.

@peter-evans
Copy link
Owner

Hi @imsteev

You can use this action to do what you want to do, yes. I think this example will help you.

In your case I think it will look something like this:

jobs:
  developPromotion:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
        with:
          ref: master
      - name: Reset base branch
        run: |
          git fetch origin develop:develop
          git reset --hard develop
      - name: Create Pull Request
        uses: peter-evans/create-pull-request@v3
        with:
          branch: release-branch

@imsteev
Copy link
Author

imsteev commented Nov 24, 2020

this works well @peter-evans, thank you for flagging the example in the README!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants