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

Show ignore conditions in a request body #7654

Merged
merged 9 commits into from
Jul 31, 2023

Conversation

honeyankit
Copy link
Contributor

@honeyankit honeyankit commented Jul 27, 2023

Context

To remove ignore conditions on the dependencies on a given pull request user needs to have option to view those conditions. This task is to implement that for the user. The PR body should look something like below:

PR Body
Dependabot Ignore Conditions Applied on the Pull Request

Dependency Name Ignore Condition
business [< 1.9, >1.8.0]
business [< 1.6.0, >1.3.0]
statesmen [< 1.2.0, >1.1.0]

The user will use the ignore condition mentioned in the PR body and will use the upcoming new unignore command to remove those conditions on a specific dependency:

Approach

In the PR body, displaying top 20 lasted ignore conditions (if any) sorted by created_at or updated_at for dependencies in the pull request.

The reason for the limiting to show only 20 ignore conditions on the PR is body is because at this moment "GitHub limits PR/comment descriptions to a max of 65,536 characters".

Fix: #2255

@honeyankit honeyankit self-assigned this Jul 27, 2023
@honeyankit honeyankit requested a review from a team as a code owner July 27, 2023 21:53
Copy link
Member

@jakecoffman jakecoffman left a comment

Choose a reason for hiding this comment

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

Looks good, nice work!

@honeyankit honeyankit force-pushed the honeyankit/add-ignore-conditions-to-pr-body branch from 409247f to ca4115b Compare July 31, 2023 17:36
@honeyankit honeyankit enabled auto-merge (squash) July 31, 2023 17:38
@honeyankit honeyankit merged commit 7cc9be1 into main Jul 31, 2023
90 checks passed
@honeyankit honeyankit deleted the honeyankit/add-ignore-conditions-to-pr-body branch July 31, 2023 18:02
Copy link

@SirJosh1987 SirJosh1987 left a comment

Choose a reason for hiding this comment

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

How to I stop what I'm messing up?


# Filter out the conditions where from_config_file is false and dependency is in @dependencies
valid_ignore_conditions = @ignore_conditions.select do |ic|
!ic[:from_config_file] && dependencies.any? { |dep| dep.name == ic[:dependency_name] }
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jurre: We also need to modify this function. My earlier assumption was wrong about the attributes of ignore_conditions, We have to replace from_config_file with source

Copy link
Contributor Author

@honeyankit honeyankit Aug 9, 2023

Choose a reason for hiding this comment

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

The source will contain string with info whether it was invoked via config file or via @dependabot ignore command. It will have to match the ignore command here.

Copy link
Contributor Author

@honeyankit honeyankit Aug 9, 2023

Choose a reason for hiding this comment

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

I have implemented @dependbot show <dep -name> ignore conditions which is something similar to this. You can get context from that and modify the ignore_conditions_table method.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have added the field created_at and updated_at in update job on this PR: https://github.com/github/dependabot-api/pull/4319

brettfo pushed a commit to brettfo/dependabot-core that referenced this pull request Oct 11, 2023
* Added ignore condition to message builder class to show the ignore conditions of the dependencies in the PR body.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Way to view all currently applied ignored dependencies / versions
4 participants