Giter VIP home page Giter VIP logo

enable-pull-request-automerge's Introduction

Enable Pull Request Auto-merge

CI GitHub Marketplace

A GitHub action to enable auto-merge on a pull request.

⚠️ There are very specific conditions under which this action will work as expected. See Conditions for details.

Usage

❗ Using this action is no longer necessary

The same functionality exists in the GitHub CLI. See the documentation here.

    - name: Enable Pull Request Automerge
      run: gh pr merge --merge --auto "1"
      env:
        GH_TOKEN: ${{ secrets.PAT }}

If you prefer to use this action:

      - uses: peter-evans/enable-pull-request-automerge@v3
        with:
          token: ${{ secrets.PAT }}
          pull-request-number: 1

Action inputs

Name Description Default
token GITHUB_TOKEN (permissions pull_requests: write, contents: write) or a repo scoped Personal Access Token (PAT). GITHUB_TOKEN
repository The target GitHub repository containing the pull request. github.repository (Current repository)
pull-request-number (required) The number of the target pull request
merge-method The merge method to use. merge, rebase or squash. merge

Conditions

The following conditions must be true for auto-merge to be enabled on a pull request.

  1. The target repository must have Allow auto-merge enabled in settings.
  2. The pull request base must have a branch protection rule with at least one requirement enabled.
  3. The pull request must be in a state where requirements have not yet been satisfied. If the pull request is in a state where it can already be merged, the action will merge it immediately without enabling auto-merge.

Dependabot example

The following example will automerge dependabot pull requests. Note that if you use the default GITHUB_TOKEN, as in the example, the merge will not trigger further workflow runs. If you want to trigger further workflow runs, you will need to use a repo scoped Personal Access Token (PAT).

name: Auto-merge Dependabot
on: pull_request

permissions:
  pull-requests: write
  contents: write

jobs:
  automerge:
    runs-on: ubuntu-latest
    if: github.actor == 'dependabot[bot]'
    steps:
      - uses: peter-evans/enable-pull-request-automerge@v3
        with:
          pull-request-number: ${{ github.event.pull_request.number }}
          merge-method: squash

Create pull request example

In the following example create-pull-request action is used to create a pull request containing some changes that we want to merge automatically once requirements have been satisfied.

      - uses: actions/checkout@v3

      # Make changes to pull request here

      - name: Create Pull Request
        id: cpr
        uses: peter-evans/create-pull-request@v3
        with:
          token: ${{ secrets.PAT }}

      - name: Enable Pull Request Automerge
        if: steps.cpr.outputs.pull-request-operation == 'created'
        uses: peter-evans/enable-pull-request-automerge@v3
        with:
          token: ${{ secrets.PAT }}
          pull-request-number: ${{ steps.cpr.outputs.pull-request-number }}
          merge-method: squash

If the "require pull request reviews" branch protection has been enabled we can optionally auto-approve the pull request by adding the following step to the example above. The if condition makes sure we don't approve multiple times if the workflow executes more than once before the pull request merges.

      - name: Auto approve
        if: steps.cpr.outputs.pull-request-operation == 'created'
        run: gh pr review --approve "${{ steps.cpr.outputs.pull-request-number }}"
        env:
          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

License

MIT

enable-pull-request-automerge's People

Contributors

actions-bot avatar dependabot[bot] avatar github-actions[bot] avatar peter-evans avatar randymarsh77 avatar williamboman 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

enable-pull-request-automerge's Issues

Error: This endpoint requires you to be authenticated.

Not sure exactly what's going on, because I have this enabled on a different repo and it works perfectly (or did? Maybe something is wrong with Github at the moment)

Anyways, I have a secret token with repo privileges, it's all verified to be a valid token with correct privileges, the name is right, etc etc.

I'm using peter-evans/enable-pull-request-automerge@v2
I'm using the following, and the action does run, I know it gets the right PR number.

      - name: Enable Pull Request Automerge
        uses: peter-evans/enable-pull-request-automerge@v2
        with:
          # same token I'm using elsewhere, verified it works and is valid
          token: ${{ secrets.REPO_SCOPED_TOKEN }}
          pull-request-number: ${{ steps.cpr.outputs.pull-request-number }}
          merge-method: rebase

In my repo settings, I have both Automatically delete head branches and Allow auto-merge enabled, and I have a branch protection rule enabled Require a pull request before merging and Require approvals (1), along with your example of auto approving it (though it never gets that far).

I'm certain I've checked off every box for this to work, and yet it seems github is refusing to work. Any ideas?

My guess is maybe github itself is broken, cause I used my secret token for the create pull request action, and it ALWAYS fails saying something like fatal: could not read Username for 'https://github.com/': No such file or directory, unless I let it use the default GITHUB_TOKEN. Creating a new secret token with the same privileges results in exactly the same errors

I think I'm at my wits end. Github seems to hate me :/

Pull request is in unstable status

Hi ,
getting the below message when trying to use the action :

Request failed due to following response errors: - ["Pull request Pull request is in unstable status"]

      - uses: peter-evans/enable-pull-request-automerge@v2
        with:
          token: ${{ secrets.MERGE_SECRET }}
          pull-request-number: ${{ github.event.number }}
          merge-method: squash

Automerging the PR vs enabling the automerge flag

Hi,

I am interested in github action that will help me to merge the PR not simply try to enable the automerge flag.

The subtle difference is going to be, that for branches that are not protected it should simply merge the pr instead of reporting error.

Same thing for the case where the PR is already checked, instead of failing to enable the auto merge flag, it should just merge it.

Are you interested in enhancing this tool in that direction?

Error: Pull Request is not mergable

Hey @peter-evans im attempting to create a PR to merge a dev branch into a qa branch. However, seeing an error message when this runs on the merge PR job of the workflow. The error appears with the message Error: Pull Request is not mergable.

Run juliangruber/merge-pull-request-action@v1
  with:
    github-token: ***
    number: 1
    method: merge
Error: Pull Request is not mergeable

Here is the particular part of the config being used in the yaml:

      - name: create PR to deploy to QA
        uses: peter-evans/create-pull-request@v3
        with:
          branch: deploy-qa
          base: react-qa
          title: QA Deploy (${{ github.actor }})
          commit-message: create PR to deploy react-dev to react-qa
          body: Auto-generated PR (via Github Actions manual workflow) to deploy react-dev to react-qa. Intiated by ${{ github.actor }}.
          delete-branch: true

I have my theories on why this is not working, but was wondering if you have seen this particular appear or if you see something that should be improved in that particular part of the yaml. Any advice is appreciated. Thank you.

step "Enable Pull Request Automerge" has been skipping

Hello Peter!

Thank you for integration. I use Create Pull Request and it works amazingly.
However, I have a very strange issue with Enable Pull Request Automerge such as action skipping this step.
I've added below the debug logs. If you have any ideas/tips, it would be very much appreciated.

      - name: Enable Pull Request Automerge
        if: steps.cpr.outputs.pull-request-operation == 'created'
        uses: peter-evans/enable-pull-request-automerge@v3
        with:
          token: ${{ secrets.PAT }}
          pull-request-number: ${{ steps.cpr.outputs.pull-request-number }}
          merge-method: squash

Debug logs:

0s
##[debug]Evaluating condition for step: 'Enable Pull Request Automerge'
##[debug]Evaluating: (success() && (steps.cpr.outputs.pull-request-operation == 'created'))
##[debug]Evaluating And:
##[debug]..Evaluating success:
##[debug]..=> true
##[debug]..Evaluating Equal:
##[debug]....Evaluating Index:
##[debug]......Evaluating Index:
##[debug]........Evaluating Index:
##[debug]..........Evaluating steps:
##[debug]..........=> Object
##[debug]..........Evaluating String:
##[debug]..........=> 'cpr'
##[debug]........=> Object
##[debug]........Evaluating String:
##[debug]........=> 'outputs'
##[debug]......=> Object
##[debug]......Evaluating String:
##[debug]......=> 'pull-request-operation'
##[debug]....=> null
##[debug]....Evaluating String:
##[debug]....=> 'created'
##[debug]..=> false
##[debug]=> false
##[debug]Expanded: (true && (null == 'created'))
##[debug]Result: false

Error: Can't enable auto-merge for this pull request.

I am getting this error - Can't enable auto-merge for this pull request.

Its merging to the protected branch (main). Should i need to update any branch protection settings?

Here is the code

      # Create Pull Request with the updated changes
      - name: Create Pull Request
        id: cpr
        uses: peter-evans/create-pull-request@v3
        with:
          token: ${{ steps.generate_token.outputs.token }}
          branch: ${{ steps.application.outputs.application-names }}
          delete-branch: true
          labels: promotion
          title: "[Promotion] ${{ steps.application.outputs.application-names }}"

      # Enable Auto-merge option in the Pull Request
      - name: Enable Pull Request Automerge
        uses: peter-evans/enable-pull-request-automerge@v1
        with:
          token: ${{ steps.generate_token.outputs.token }}
          pull-request-number: ${{ steps.cpr.outputs.pull-request-number }}
          merge-method: squash

Doesn't work with GitHub Enterprise

I'm having an issue using this in GitHub Enterprise. It appears that the API base URl is likely api.github.com. I was able to resolve my issue by mirroring your repo with a patch to configure the baseUrl when initializing OctoKit.

I'd be happy to submit a PR, but it also looks like you support GHE in both your repository-dispatch and create-pull-request actions in different ways.

Env var: https://github.com/peter-evans/create-pull-request/blob/main/src/github-helper.ts#L27
And, probably this github.getOctokit method: https://github.com/peter-evans/repository-dispatch/blob/main/src/main.ts#L17

I've been using your repository-dispatch action without issues, so was a bit surprised by this behavior. Please LMK if you'd like me to submit a patch, and your preference on implementation.

Thanks! And, thanks for publishing all these handy actions 🥂

Option for disabling automerge

This could be totally up to another action project, but still posting here for now just to raise the idea, though I don't know if it's implementable.

I'm proposing adding an input such as mode, which is default to enable, and ignores the merge-method input when set to disable. The purpose is to allow this action to disable automerge in desired conditions. An example scenario would be something like below, triggered when the base of PR is edited (I bet there's a better way to trigger this).

name: PR Edited
on:
  pull_request:
    types: [edited]
jobs:
  enable-automerge:
    if: ${{ github.event.pull_request.base.ref != 'main' }}
    runs-on: ubuntu-latest
    steps:
      - uses: peter-evans/enable-pull-request-automerge@v1
        with:
          token: ${{ secrets.MY_PAT }}
          pull-request-number: ${{ github.event.pull_request.number }}
  disable-automerge:
    if: ${{ github.event.pull_request.base.ref == 'main' }}
    runs-on: ubuntu-latest
    steps:
      - uses: peter-evans/enable-pull-request-automerge@v1
        with:
          token: ${{ secrets.MY_PAT }}
          pull-request-number: ${{ github.event.pull_request.number }}
          mode: disable

I'm struggling with finding another action that disables automerge in marketplace and thought it would be nice if this action has such addition.

A Personal Access Token is not actually required. A GITHUB_TOKEN will work

Hey,

First of all, thank you for making this Action, it's really helpful.

I wanted to point out that your readme says using a GITHUB_TOKEN will not work when in fact it can.

I had been struggling for days to figure out how to create an action that would auto-merge pull request from approved bots (or any approved user) to a protected branch after passing checks, but would NOT approve requests from just anybody. The question of how to auto-merge dependabot pull requests is a popular one. I ended up pulling it off with this workflow (Which as you can see does not use a PAT):

name: automerge
on:
  pull_request_target:
jobs:
  automerge:
    runs-on: ubuntu-latest
    env:
      # append additional users below to allow automerge for them
      USER_ALLOWLIST: |
        '[
          "${{github.repository_owner}}",
          "dependabot[bot]"
        ]'
    steps:

      - name: print troubleshooting info
        run: |
          echo "event name:" ${{github.event_name}}
          echo "event action:" ${{github.event.action}}
          echo "actor:" ${{github.actor}}
          echo "repository owner:" ${{github.repository_owner}}
          echo "pull request user:" ${{github.event.pull_request.user.login}}
          echo "pull request number:" ${{github.event.pull_request.number}}
          echo "allow list:" ${{ env.USER_ALLOWLIST }}
          echo "actor approved?": ${{contains(fromJSON(env.USER_ALLOWLIST), github.actor)}}
          echo "pull request user approved?": ${{contains(fromJSON(env.USER_ALLOWLIST), github.event.pull_request.user.login)}}

      - name: automerge
        if: >-
          ${{
            contains(fromJSON(env.USER_ALLOWLIST), github.actor) &&
            contains(fromJSON(env.USER_ALLOWLIST), github.event.pull_request.user.login)
          }}
        uses: peter-evans/enable-pull-request-automerge@v2
        with:
          token: ${{secrets.GITHUB_TOKEN}}
          pull-request-number: ${{github.event.pull_request.number}}
          merge-method: squash

The trick here is to use the "pull_request_target" event instead of the "pull_request" event. The GITHUB_TOKEN from a pull_request event does not have the required permissions because it runs in the security context of the requestor. On the other hand, the pull_request_target event is identical to the pull_request event in every way except that the GITHUB_TOKEN runs in the security context of the "target" (the approver).

Obviously then pull_request_target can be dangerous because it can allow anyone from the general public full write access to the repo by combining it with enable-pull-request-automerge. You can see that my approach to secure the workflow above is to build an allow list.

Anyway, I just wanted to share this with you because I was pretty excited to finally get it working and not having to use PAT. Feel free to share my workflow above as an example in your readme. I suspect a lot of people who are looking for a way to automerge dependabot and other bots wind up here.

Automerge can't find recently created PR

I'm using the peter-evans/create-pull-request@v3 and immediately after using this to enable the automerging. Sometimes the PR can't be found, it appears to be a bit of a race condition where the github api hasn't been updated quite yet, so the automerge action can't find the PR
image

Don't fail for 0th PR

I'm using cron to update dependencies. Sometimes it produces no change and makes peter-evans/enable-pull-request-automerge fail.
It's possible to add if condition, but I guess it would be nicer to just ignore such error.

I propose that peter-evans/enable-pull-request-automerge ignores pull-request-number: 0 instead of failing

on:
  schedule:
    - cron: '0 0 * * *'
# ...
      - uses: actions/checkout@v2

      # update dependencies

      - name: Create Pull Request
        id: cpr
        uses: peter-evans/create-pull-request@v3
        with:
          token: ${{ secrets.PAT }}

      - name: Enable Pull Request Automerge
        uses: peter-evans/enable-pull-request-automerge@v1
        with:
          token: ${{ secrets.PAT }}
          pull-request-number: ${{ steps.cpr.outputs.pull-request-number }}
          merge-method: squash

Possible to use Github Apps tokens instead of PAT?

I know in the docs it says that it's required a repo scoped Personal Access Token (PAT) is used, where GITHUB_TOKEN won't work.

Is it possible to use Github Apps instead of PAT, which seems more appropriate in organization projects?

I tried something like this and doesn't work, even with all permissions set to Read & Write for the App.

steps:
      - name: Generate token
        id: automerge_t
        uses: tibdex/github-app-token@v1
        with:
          app_id: ${{ secrets.APP_ID }}
          private_key: ${{ secrets.APP_PRIVATE_KEY }}
      - name: Enable Pull Request Automerge
        uses: peter-evans/enable-pull-request-automerge@v1
        with:
          token: ${{ steps.automerge_t.outputs.token }}
          pull-request-number: ${{ github.event.pull_request.number }}
          merge-method: "REBASE"

Error message isn't very informative:

Fetching pull request ID
##[debug]PullRequestId: 'MDExOlB1bGxSZXXXXXXXXjEyMTM0MTM2'
Enabling auto-merge on pull request ID MDExOlB1bGxSZXXXXXXXjEyMTM0MTM2
##[debug]AutoMergeRequest: { enabledAt: null, enabledBy: { login: 'my-github-app' } }
Error: Failed to enable auto-merge
##[debug]Node Action run completed with exit code 1
##[debug]Finishing: Enable Pull Request Automerge

PR's status remains Open though the commit is merged when using GitHub App tokens

Subject of the issue

The code is committed to dev automatically after all checks are passed with automerge as intended. But then the PR remains in Open state and the branch is not deleted though delete-branch is set to true.

Also, ensured that we have set Automatically delete head branches.

Below is the code snippet that is used. Please advise if we are missing something or it is how it is. Thanks!

Steps to reproduce

      - name: Create Pull Request
        id: cpr
        uses: peter-evans/create-pull-request@v3
        with:
          author: xxx
          base: dev
          branch: xxx
          commit-message: xxx
          committer: xxx
          delete-branch: true
          team-reviewers: |
            xxx
          title: |
           xxx
          token: ${{ steps.xxx.outputs.token }}

      - name: Enable Pull Request Automerge
        if: steps.cpr.outputs.pull-request-operation == 'created'
        uses: peter-evans/enable-pull-request-automerge@v1
        with:
          token: ${{ steps.xxx.outputs.token }}
          pull-request-number: ${{ steps.cpr.outputs.pull-request-number }}
          merge-method: squash

      - name: Approve Pull Request
        if: steps.cpr.outputs.pull-request-operation == 'created'
        uses: juliangruber/approve-pull-request-action@v1
        with:
          github-token: ${{ secrets.GITHUB_TOKEN }}
          number: ${{ steps.cpr.outputs.pull-request-number }}

Error "Pull request is in clean status"

Hello! I'm trying to add this to one of my repos and I'm running into this error when trying run the action. The full workflow file can be found here. I couldn't really find anything on the internets, do you perhaps have any ideas what might be going wrong? My best guess is that it's attempting to enable automerge before it's ready (definition of ready being: no checks have been registered with the PR yet)

Error: Could not resolve to a PullRequest with the number of 0.

I am getting this error (Error: Could not resolve to a PullRequest with the number of 0). Not sure what this mean. Can you explain why this error is happening? Can you help me out to fix this?

Here is my code

      # Create Pull Request with the updated changes
      - name: Create Pull Request
        if: steps.application.outputs.application-names != ''
        id: cpr
        uses: peter-evans/create-pull-request@v3
        with:
          token: ${{ steps.generate_token.outputs.token }}
          body: |
            Automated promotion of the following applications: ${{ steps.application.outputs.application-names }}
            Revision: ${{ github.event.inputs.revision }}
          branch: ${{ steps.application.outputs.application-names }}
          delete-branch: true
          labels: promotion
          title: "[Promotion] ${{ matrix.service }}"

      # Enable Auto-merge option in the Pull Request
      - name: Enable Pull Request Automerge
        if: steps.application.outputs.auto-merge == 'true'
        uses: peter-evans/enable-pull-request-automerge@v1
        with:
          token: ${{ steps.generate_token.outputs.token }}
          pull-request-number: ${{ steps.cpr.outputs.pull-request-number }}
          merge-method: squash

The pull request also DID NOT get created.

Capture

Create auto approve action

Found this in README:

      - name: Auto approve
        if: steps.cpr.outputs.pull-request-operation == 'created'
        uses: actions/github-script@v3
        with:
          github-token: ${{ secrets.GITHUB_TOKEN }}
          script: |
            await github.pulls.createReview({
              owner: context.repo.owner,
              repo: context.repo.repo,
              pull_number: ${{ steps.cpr.outputs.pull-request-number }},
              event: 'APPROVE'
            })

This could be a separate action.

Failed to enable automerge - Auto-merge on, PAT with Repo access, protected branch with requirements

I'm getting Error: Failed to enable auto-merge

https://github.com/06kellyjac/suckless-git-overlay/runs/2355710781?check_suite_focus=true

I've got auto merge enabled

image

The branch is protected and requires the tests to pass

image

The auto-merge button shows up if I look after it's been created

automerge

But for some reason the action can't enable it

Is there anything else I can do to debug this? Or do you have any idea what could be the cause?
Maybe it's because it's triggering push and pr tests??

Alternative to approve pull request action

I was looking to an alternative for juliangruber/approve-pull-request-action and I thought it could be useful for someone else:

      - name: Approve pull request
        run: gh pr review ${{ steps.create-pr.outputs.pull-request-number }} --approve
        env:
          GITHUB_TOKEN: ${{ secrets.AUTHORIZED_TOKEN }}
        if: steps.create-pr.outputs.pull-request-operation == 'created'

Action fails after new release v2.4.0

After the v2.4.0 is released our workflows started breaking, have attached relevant screenshots, please check.

Download action repository 'peter-evans/enable-pull-request-automerge@v2' (SHA:51b7924f8e9b3bb022e2bb6f30e478e199bfca43)

.../_temp/13c7f0de-517d-4ec7-9fc3-993eb6814875.sh: line 1: merge-method=${INPUT,,}: bad substitution Error: Process completed with exit code 1.

Screenshot 2023-03-08 at 12 10 24 PM

Screenshot 2023-03-08 at 12 11 30 PM

Other Relevant Info

  • Running on self-hosted runners
  • The failures encountered till now are all on mac-mini machines as of now

Action doesn't work without "Require approvals"

Hello,
I tried to use the action in combination with the Create PR action.
My develop branch has protection rule activated with "Require status checks before merging". However then the Auto merge action failed with the following errors:

Error: Unable to enable automerge. Make sure you have enabled branch protection with at least one status check marked as required. See https://github.com/peter-evans/enable-pull-request-automerge#conditions for more information.
Error: Request failed due to following response errors:

  • ["Pull request Pull request is in clean status"]

When I selected additionally "Require approvals", the auto merge was successful, but then obviously the branch required approval.
I then added (as described in README) https://github.com/juliangruber/approve-pull-request-action but then again it failed with "Cannot approve your own pull request".

Is this scenario at all possible?

Branch is not deleted

During pull request setup, the delete-branch method was set to true.

Received:

Unexpected input(s) 'delete-branch', valid inputs are ['token', 'repository', 'pull-request-number', 'merge-method']

Configuration:

Run peter-evans/enable-pull-request-automerge@v3
----
  with:
    token: ***
    pull-request-number: 147
    merge-method: rebase
    delete-branch: true
    repository: carstencodes/pdm-bump
  env:
    pdm_version: 2.8.2
    pythonLocation: /opt/hostedtoolcache/Python/[3](https://github.com/carstencodes/pdm-bump/actions/runs/5742218024/job/15563903769#step:15:3).11.[4](https://github.com/carstencodes/pdm-bump/actions/runs/5742218024/job/15563903769#step:15:4)/x64
    PKG_CONFIG_PATH: /opt/hostedtoolcache/Python/3.11.4/x64/lib/pkgconfig
    Python_ROOT_DIR: /opt/hostedtoolcache/Python/3.11.4/x64
    Python2_ROOT_DIR: /opt/hostedtoolcache/Python/3.11.4/x64
    Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.11.4/x64
    LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.11.4/x64/lib:/opt/hostedtoolcache/Python/3.11.2/x64/lib
    PYTHONPATH: /home/runner/.local/share/pdm/venv/lib/python3.11/site-packages/pdm/pep[5](https://github.com/carstencodes/pdm-bump/actions/runs/5742218024/job/15563903769#step:15:5)82
    LD_PRELOAD: /lib/x8[6](https://github.com/carstencodes/pdm-bump/actions/runs/5742218024/job/15563903769#step:15:6)_64-linux-gnu/libgcc_s.so.1
    PDM_UPDATE_OUTPUT: 🔒 Lock successful Packages to update: - chardet 5.1.0 -> 5.2.0 - rich 13.5.1 -> 13.5.2
    PDM_PACKAGES_TO_UPDATE: Packages to update:
    - chardet 5.1.0 -> 5.2.0
    - rich 13.5.1 -> 13.5.2
    PDM_UPDATED_PACKAGES_NAMES:   - chardet 5.1.0 -> 5.2.0
    - rich 13.5.1 -> 13.5.2
    PDM_NUMBER_OF_NEW_PACKAGES: 2
    GIT_PDM_TITLE: chore: Updated 2 dependencies in pdm.lock
    PULL_REQUEST_NUMBER: 147

Example pipeline with complete log

Unable to auto approve

I am unable to auto approve the PR as i get error failed to create review: Message: Can not approve your own pull request

jobs:
  otel-collector-patching:
    runs-on: [xyz]
    steps:
      - name: Checkout
        uses: actions/checkout@v3

      - name: Find latest version
        id: script
        run: |
          source test.sh
      - name: Create Pull Request
        id: automerge
        uses: peter-evans/create-pull-request@v5
        with:
          token: "${{ secrets.GITHUB_TOKEN }}" # Require token to run this PR
          author: "sdk[bot] <120429439+sdk-renovate[bot]@users.noreply.github.com>"
          branch: abcd-${{ env.branch_name }}
          delete-branch: true
          base: main
          commit-message: Latest version
          title: Latest version
          body: |
            Weekly checked
              - bla bla
              - bla bla
      - name: Enable Pull Request Automerge
        run: gh pr merge --squash --auto "${{ steps.automerge.outputs.pull-request-number }}"
        env:
          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

      - name: Auto approve
        run: gh pr review --approve "${{ steps.automerge.outputs.pull-request-number }}"
        env:
          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

All the steps works fine except the auto approve one. This returns Can not approve your own pull request

Failing to auto-merge pull request to separate repository

If I understand correctly I'm covering all the conditions specified here, but I might me wrong cause I'm quite a noob 😋. Would you mind having a look?

Run peter-evans/enable-pull-request-automerge@v2
Fetching pull request ID
Enabling auto-merge on pull request ID PR_kwDOF66_ps45hpts
Error: Request failed due to following response errors:
 - ["Pull request Pull request is closed"]

Corresponding run: https://github.com/billsioros/cookiecutter-pypackage/actions/runs/5068669630

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.