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

Action prints an error upon merging, but merges successfully #1609

Open
antoineco opened this issue Nov 27, 2022 · 1 comment
Open

Action prints an error upon merging, but merges successfully #1609

antoineco opened this issue Nov 27, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@antoineco
Copy link

How would you describe the issue?

Upon merging while authenticated as a GitHub Application (bot), the Action prints the following error, but merges successfully anyway:

An error occurred while merging the Pull Request. This is usually caused by the base branch being out of sync with the target branch. In this case, the base branch must be rebased. Some tools, such as Dependabot, do that automatically.

The step doesn't fail despite the error, it simply returns successfully and the PR gets merged.

Example from a recent workflow run: https://github.com/deviantony/docker-elk/actions/runs/3555997794/jobs/5973029853#step:3:12

The Application has the following permissions assigned:

  • Administration (Read-only)
  • Pull request (Read-only)
  • Contents (Read and write)
  • Metadata (Read-only)

How can we reproduce the issue?

on:
  workflow_run:
    workflows: [ CI ]
    types:
      - completed

# ...

jobs:

  merge:
    if: github.event.workflow_run.conclusion == 'success'
    runs-on: ubuntu-latest

    steps:
      - name: Approve and merge
        uses: ridedott/merge-me-action@v2
        with:
          GITHUB_LOGIN: my-app-name
          GITHUB_TOKEN: my-app-token

What are the expected results?

Print a more detailed error: what failed and why.

Alternatively, don't print an error if the PR was merged successfully.

How much does it hurt?

1/10

@antoineco antoineco added the bug Something isn't working label Nov 27, 2022
@antoineco
Copy link
Author

antoineco commented Nov 27, 2022

My suggestion would be to log the error below at the warning level instead of debug, because if the PR gets merged successfully on the first attempt, users don't get a chance to run their workflow again with debug messages enabled:

logInfo(
'An error occurred while merging the Pull Request. This is usually ' +
'caused by the base branch being out of sync with the target ' +
'branch. In this case, the base branch must be rebased. Some ' +
'tools, such as Dependabot, do that automatically.',
);
/* eslint-disable-next-line @typescript-eslint/no-base-to-string */
logDebug(`Original error: ${(error as Error).toString()}.`);


edit: in my case the error is due to self approval:

##[debug] Original error: GraphqlError: Can not approve your own pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant