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(auto-approve): allow Python major dependency updates #4998

Merged
merged 12 commits into from
Apr 10, 2023

Conversation

sofisl
Copy link
Contributor

@sofisl sofisl commented Mar 14, 2023

Fixes #4126

cc @parthea

@sofisl sofisl changed the title build: update Python dependency flow fix: update Python dependency flow Mar 16, 2023
@sofisl sofisl changed the title fix: update Python dependency flow fix[auto-approve]: update Python dependency flow Mar 21, 2023
@sofisl sofisl changed the title fix[auto-approve]: update Python dependency flow fix: [auto-approve] update Python dependency flow Mar 21, 2023
@@ -29,6 +29,7 @@
"dependencies": {
"@google-cloud/secret-manager": "^4.1.1",
"ajv": "^8.11.0",
"compare-versions": "^6.0.0-rc.1",
Copy link
Contributor

Choose a reason for hiding this comment

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

We already have the semver dependency in our tree. Can we re-use that one?

@sofisl sofisl requested a review from chingor13 March 29, 2023 19:20

const isVersionValid = semver.compare(oldNum, newNum) === -1;
Copy link
Contributor

Choose a reason for hiding this comment

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

When reviewing this line, it is not clear, what makes it valid or not. I would have to dig into the implementation of semver.compare.

Consider putting this into a tested helper function that is describing what this check is ("is valid" is not descriptive enough). For example, isNotMajorVersionBump() is readable.

@sofisl sofisl requested a review from chingor13 March 29, 2023 20:26
* @param versions an object containing the previous and newer versions of the package being updated
* @returns whether the minor version was upgraded.
*/
export function isVersionBumped(versions: Versions): boolean {
Copy link
Contributor

Choose a reason for hiding this comment

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

If we don't care what kind a version bump, should we just check if oldVersion != newVersion? Why do we need to a semver comparison between constructed values?

Copy link
Contributor

Choose a reason for hiding this comment

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

Or why have this check at all?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We'd want to confirm that it was increasing. You wouldn't want to autoapprove a rollback, for example.

Copy link
Contributor

Choose a reason for hiding this comment

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

For readability, please use semver.gt or semver.lt instead (https://github.com/npm/node-semver#comparison). The semver.compare return value (1, 0, -1) is used for sorting.

@sofisl sofisl requested a review from chingor13 March 29, 2023 23:47
* @param versions an object containing the previous and newer versions of the package being updated
* @returns whether the minor version was upgraded.
*/
export function isVersionBumped(versions: Versions): boolean {
Copy link
Contributor

Choose a reason for hiding this comment

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

For readability, please use semver.gt or semver.lt instead (https://github.com/npm/node-semver#comparison). The semver.compare return value (1, 0, -1) is used for sorting.

@sofisl sofisl requested a review from chingor13 March 30, 2023 21:32
@sofisl sofisl enabled auto-merge (squash) March 30, 2023 21:53
@chingor13 chingor13 changed the title fix: [auto-approve] update Python dependency flow fix(auto-approve): allow Python major dependency updates Apr 10, 2023
@chingor13 chingor13 disabled auto-merge April 10, 2023 17:50
@chingor13 chingor13 enabled auto-merge (squash) April 10, 2023 17:50
@chingor13 chingor13 merged commit 04b8d47 into main Apr 10, 2023
@chingor13 chingor13 deleted the addPythonDependencyFlow branch April 10, 2023 17:51
@release-please release-please bot mentioned this pull request Aug 21, 2023
@release-please release-please bot mentioned this pull request Sep 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

FR(autoapprove): Update the criteria for PythonDependency
2 participants