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

Avoid rerequesting reviews with the new codeowners mechanism #347592

Merged
merged 2 commits into from
Oct 9, 2024

Conversation

infinisil
Copy link
Member

@infinisil infinisil commented Oct 9, 2024

As a follow-up to #336261, the automation should never rerequest reviews from users that already reviewed the changes, which is what was happening before this change: #347354 (comment)

Furthermore, request reviews from individual team members. This makes this alternate codeowner mechanism behave differently than the native GitHub one, but there's no other way to avoid rerequesting reviews from teams when a member already reviewed the PR.

Things done


This work is sponsored by Antithesis

Add a 👍 reaction to pull requests you find important.

Copy link
Contributor

@philiptaron philiptaron left a comment

Choose a reason for hiding this comment

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

Approved with non-substantial nitpicking.

@@ -80,7 +80,7 @@ if ! "$SCRIPT_DIR"/verify-base-branch.sh "$tmp/nixpkgs.git" "$headRef" "$baseRep
fi

log "Getting code owners to request reviews from"
"$SCRIPT_DIR"/get-reviewers.sh "$tmp/nixpkgs.git" "$baseBranch" "$headRef" "$ownersFile" "$prAuthor" > "$tmp/reviewers.json"
"$SCRIPT_DIR"/get-reviewers.sh "$tmp/nixpkgs.git" "$baseBranch" "$headRef" "$ownersFile" "$prAuthor" "$baseRepo" "$prNumber" > "$tmp/reviewers.json"
Copy link
Contributor

Choose a reason for hiding this comment

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

Comment warning: complete nitpicking.

As a matter of order, what makes the most sense to me is:

  1. headRef
  2. ownersFile
  3. baseRepo
  4. baseBranch
  5. prNumber
  6. prAuthor

plus then aligning these names with the names of the variables in the get-reviewers script.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done, but I moved headRef before prNumber because both are related to the PR :)

@@ -32,8 +34,8 @@ log "This PR touches ${#touchedFiles[@]} files"
# remove code owners to avoid pinging them
git -C "$gitRepo" show "$baseRef":"$ownersFile" > "$tmp"/codeowners

# Associative arrays with the team/user as the key for easy deduplication
declare -A teams users
# Associative with the user as the key for easy deduplication
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
# Associative with the user as the key for easy deduplication
# Associative array with the user as the key for easy de-duplication

ci/request-reviews/get-reviewers.sh Show resolved Hide resolved
ci/request-reviews/get-reviewers.sh Show resolved Hide resolved
The automation should never rerequest reviews from users that already
reviewed the changes, which is what was happening before this change:

NixOS#347354 (comment)

Also reorder the arguments to make more sense
This makes this codeowner mechanism behave differently than the native
one, but there's no other way to avoid rerequesting reviews from teams
when a member already reviewed the PR.
@infinisil infinisil force-pushed the codeowners-avoid-rerequests branch from 7cc6098 to 1ff83b2 Compare October 9, 2024 21:49
@infinisil infinisil merged commit cf952d3 into NixOS:master Oct 9, 2024
10 of 11 checks passed
@infinisil infinisil deleted the codeowners-avoid-rerequests branch October 9, 2024 22:15
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