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

fix(gitlab): Don't delete report_approver and code_owner approval rules #27963

Merged
merged 2 commits into from Mar 17, 2024

Conversation

Nikoms
Copy link
Contributor

@Nikoms Nikoms commented Mar 16, 2024

Changes

This is a fix for gitlab users. Renovate tries to delete approval rules that can't be deleted. The Gitlab API returns a 403 for 2 kind of rules: report_approver and code_owner. I just updated the filter of the approval rules that will be deleted from this:

    const existingRegularApproverRules = rules?.filter(
      ({ rule_type, name }) =>
        rule_type !== 'any_approver' && name !== ruleName
    );

to this:

    const existingRegularApproverRules = rules?.filter(
      ({ rule_type, name }) =>
        rule_type !== 'any_approver' && name !== ruleName && rule_type!== 'report_approver' && rule_type!== 'code_owner',
    );

Context

See #27950

CleanShot 2024-03-16 at 16 39 49

Documentation (please check one with an [x])

  • No documentation update is required

How I've tested my work (please select one)

I have verified these changes via:

  • Code inspection only, or
  • Newly added/modified unit tests, or
  • No unit tests but ran on a real repository, or
  • Both unit tests + ran on a real repository

@viceice viceice changed the title fix(gitlab): Don't delete approval rules (report_approver, code_owner… fix(gitlab): Don't delete report_approver and code_owner approval rules Mar 16, 2024
Copy link
Member

@viceice viceice left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needs prettier fix

@Nikoms
Copy link
Contributor Author

Nikoms commented Mar 16, 2024

Indeed, my bad :)

Fixed

@viceice viceice added the auto:no-done-comments Don't say "Done" or "Please review" - request a review instead label Mar 17, 2024
Copy link
Contributor

Hi there,

You are using done comments which cause a lot of noise/notifications. Instead, please use GitHub's web interface to request another review. Please read our contributing guidelines to reduce noise.

Good luck,

The Renovate team

@rarkins rarkins added this pull request to the merge queue Mar 17, 2024
Merged via the queue into renovatebot:main with commit 92ab91b Mar 17, 2024
36 checks passed
@renovate-release
Copy link
Collaborator

🎉 This PR is included in version 37.252.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 18, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
auto:no-done-comments Don't say "Done" or "Please review" - request a review instead
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants