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

new bot_account policy effectively makes rebase a premium feature when used in conjunction with renovate or other bots #5074

Closed
DanySK opened this issue Mar 10, 2023 · 8 comments

Comments

@DanySK
Copy link

DanySK commented Mar 10, 2023

Expected Behavior

It is possible to rebase PRs created by GitHub applications (such as dependabot or renovate) with the free version of mergify.
Worst case, with the previous behaviour (randomly picked user with sufficient rights)

Actual Behavior

Leaving bot_account unspecified prevents the rebase (the user cannot be impersonated).
Specifying the bot account makes Mergify fail (premium feature)

Steps to Reproduce the Problem

  1. Create a repository and enable renovate
  2. Configure mergify for rebasing out-of-date PRs from renovate[bot]
  3. Let renovate open a PR
  4. observe mergify fail

Specifications

Example config triggering the problem

pull_request_rules:
  - name: Auto-rebase if appropriately labeled or if the author is an authorized bot
    conditions:
      - or:
        - label=auto-update-rebase
        - and:
            - label=dependencies
            - or: &authors_are_bots
                - author=renovate[bot]
                - author=dependabot[bot]
      - -draft
      - -conflict
    actions:
      rebase:
@DanySK
Copy link
Author

DanySK commented Mar 10, 2023

Suggested solutions:

  • try the PR author first, and then random org members (fallback to previous behavior)
  • if the new behavior is intentional, consider not running the operation and notify with a message rather than failing entirely (thus also blocking auto-merge from renovate).

@sileht
Copy link
Member

sileht commented Mar 10, 2023

if the new behavior is intentional, consider not running the operation and notify with a message rather than failing entirely (thus also blocking auto-merge from renovate).

Hi @DanySK do you have a pull request link where we can see the failure?

@DanySK
Copy link
Author

DanySK commented Mar 10, 2023

Sure: AlchemistSimulator/Alchemist#2086

Edit: adding a snapshot, as in case of modifications the run would be different
image

DanySK added a commit to AlchemistSimulator/Alchemist that referenced this issue Mar 13, 2023
DanySK added a commit to DanySK/docker-manjaro-with-zsh that referenced this issue Mar 13, 2023
DanySK added a commit to DanySK/gradle-kotlin-qa that referenced this issue Mar 13, 2023
DanySK added a commit to DanySK/Tutorial-GitHub-Actions-Minimal that referenced this issue Mar 13, 2023
@DanySK
Copy link
Author

DanySK commented Mar 13, 2023

It is even worse: also explicitly excluding accounts that cannot be impersonated lead to an error in mergify:

pull_request_rules:

  - name: Auto-rebase if appropriately labeled
    conditions:
      - label=auto-update-rebase
      # work around for Mergifyio/mergify#5074
      - not:
          or: &authors_are_bots
            - author=renovate[bot]
            - author=dependabot[bot]
      - -draft
      - -conflict
    actions:
      rebase:

image

Tested on: DanySK/shared-slides#73

DanySK added a commit to DanySK/shared-slides that referenced this issue Mar 13, 2023
DanySK added a commit to DanySK/course-laboratory-of-software-systems that referenced this issue Mar 13, 2023
DanySK added a commit to DanySK/code-plagiarism-detector that referenced this issue Mar 13, 2023
DanySK added a commit to DanySK/multi-jvm-test-plugin that referenced this issue Mar 13, 2023
DanySK added a commit to DanySK/gradle-pre-commit-git-hooks that referenced this issue Mar 13, 2023
DanySK added a commit to DanySK/template-for-gradle-plugins that referenced this issue Mar 13, 2023
DanySK added a commit to Protelis/Protelis that referenced this issue Mar 13, 2023
@sileht
Copy link
Member

sileht commented Mar 15, 2023

@DanySK
Copy link
Author

DanySK commented Mar 15, 2023

Yes, but, with the new policy, rebasing may cause Mergify to fail.
I would suggest having an option like fallback_to_random_org_user, defaulting to false. Mergify would then:

  • if bot_account is specified, use the bot account
  • if bot account is unspecified (or cannot be specified, as the account has no premium access):
    • if the author of the PR can be impersonated, run impersonating the author of the PR
    • if the author of the PR cannot be impersonated and fallback_to_random_org_user is true, find a member of the organization to impersonate (legacy behavior)
    • otherwise, fail.

DanySK added a commit to DanySK/Template-Hugo-Reveal-Slides that referenced this issue Mar 15, 2023
DanySK added a commit to DanySK/course-phd-devops-scientific-research that referenced this issue Mar 15, 2023
DanySK added a commit to DanySK/docker-manjaro-with-zsh that referenced this issue Mar 15, 2023
DanySK added a commit to DanySK/course-laboratory-of-software-systems that referenced this issue Mar 15, 2023
DanySK added a commit to DanySK/zstd-container that referenced this issue Mar 16, 2023
DanySK added a commit to DanySK/rrmxmx-kt that referenced this issue Mar 16, 2023
DanySK added a commit to DanySK/publish-on-central that referenced this issue Mar 16, 2023
DanySK added a commit to Protelis/Protelis-Parser that referenced this issue Mar 16, 2023
DanySK added a commit to DanySK/gradle-java-qa that referenced this issue Mar 16, 2023
DanySK added a commit to DanySK/multi-jvm-test-plugin that referenced this issue Mar 16, 2023
DanySK added a commit to Protelis/Protelis that referenced this issue Mar 16, 2023
DanySK added a commit to DanySK/action-checkout that referenced this issue Mar 16, 2023
DanySK added a commit to DanySK/java-quadtree that referenced this issue Mar 16, 2023
DanySK added a commit to AlchemistSimulator/Protelis-Incarnation-tutorial that referenced this issue Mar 16, 2023
DanySK added a commit to AlchemistSimulator/alchemist-primer that referenced this issue Mar 16, 2023
DanySK added a commit to DanySK/template-for-kotlin-multiplatform-projects that referenced this issue Mar 16, 2023
DanySK added a commit to DanySK/moving-dots-for-mirko that referenced this issue Mar 16, 2023
DanySK added a commit to DanySK/Thread-Inheritable-Resource-Loader-for-Java that referenced this issue Mar 16, 2023
DanySK added a commit to DanySK/experiment-2023-lmcs-pm10-pollution-space-sampling that referenced this issue Mar 16, 2023
DanySK added a commit to DanySK/kotlin-container that referenced this issue Mar 16, 2023
DanySK added a commit to DanySK/gson-extras that referenced this issue Mar 16, 2023
DanySK added a commit to DanySK/semantic-release-preconfigured-conventional-commits that referenced this issue Mar 16, 2023
DanySK added a commit to Protelis/Protelis-Demo that referenced this issue Mar 16, 2023
DanySK added a commit to APICe-at-DISI/exercises that referenced this issue Mar 16, 2023
DanySK added a commit to unibo-oop/sample-javafx-project that referenced this issue Mar 16, 2023
DanySK added a commit to DanySK/git-sensitive-semantic-versioning-gradle-plugin that referenced this issue Mar 16, 2023
DanySK added a commit to APICe-at-DISI/PPS-ci-examples that referenced this issue Mar 16, 2023
DanySK added a commit to DanySK/Template-for-Kotlin-JVM-Projects that referenced this issue Mar 16, 2023
DanySK added a commit to APICe-at-DISI/oop-lab that referenced this issue Mar 19, 2023
nicolasfara added a commit to pulvreakt/pulvreakt that referenced this issue Mar 20, 2023
DanySK added a commit to DanySK/DisCoTec-2021-Tutorial that referenced this issue Mar 20, 2023
DanySK added a commit to DanySK/Template-LaTeX-LNCS that referenced this issue Mar 21, 2023
@jaellio
Copy link

jaellio commented Mar 31, 2023

I believe I am running into the same issue using the rebase action with dependabot as the PR author. I get the following error:

In the rule Automatic rebase, the action rebase configuration is invalid:
Invalid bot_account value
GitHub login contains invalid characters: dependabot[bot]

Is there a potential workaround for PRs created by GitHub applications to still utilize the rebase action?

@DanySK
Copy link
Author

DanySK commented Sep 4, 2023

Since bot_account is no longer a premium feature, the original issue can be resolved by using a machine user with force-push permissions.

@jd jd closed this as completed Mar 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

4 participants