Skip to content

Do not nil out the PR message for jobs updating a PR#6813

Merged
brrygrdn merged 1 commit intomainfrom
brrygrdn/fix-pr-superseding
Mar 10, 2023
Merged

Do not nil out the PR message for jobs updating a PR#6813
brrygrdn merged 1 commit intomainfrom
brrygrdn/fix-pr-superseding

Conversation

@brrygrdn
Copy link
Copy Markdown
Contributor

This fixes a bug introduced in #6792.

The newly introduced DependencyChange class made an assumption that any content created as result of a Job which had updating_a_pull_request? should not generate a pr_message object as the ApiClient historically did not accept a pr_message argument.

In reality, we have this scenario when updating_a_pull_request? is true to consider:

job_dependencies = job.dependencies.map(&:downcase)
if updated_deps.map(&:name).map(&:downcase) != job_dependencies
# The dependencies being updated have changed. Close the existing
# multi-dependency PR and try creating a new one.
close_pull_request(reason: :dependencies_changed)
create_pull_request(updated_deps, updated_files)

In a scenario where we close the existing PR and create a new one, the nil PR message blocks the API accepting the request.

@brrygrdn brrygrdn requested a review from a team as a code owner March 10, 2023 18:57
@brrygrdn brrygrdn merged commit e99e9c1 into main Mar 10, 2023
@brrygrdn brrygrdn deleted the brrygrdn/fix-pr-superseding branch March 10, 2023 19:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants