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 a bug where teams aren't added as reviewers when the author comments and the author is on the reviewer team #87

Merged
merged 4 commits into from
Jun 5, 2024

Conversation

lillialexis
Copy link
Member

@lillialexis lillialexis commented Jun 4, 2024

Summary:

Previously, when Gerald would run, it wouldn't add a team to the reviewer list if any member of the team had already reviewed the PR.

The problem is that PR authors can add comments to their PRs, and those are "review" objects. So, if an author makes a draft PR, adds some comments, clicks "Ready for review", and the author is a member of a team that Gerald would add, Gerald wouldn't add that team.

Very sneaky bug!! This fixes that. It still adds the team if the author commented (or any team member added a non-approving, non-rejecting review, such as a comment, or a pending review).

Issue: https://khanacademy.atlassian.net/browse/FEI-5620

Test plan:

Buggy case:

  1. Make a draft PR (in a repo where a team is always added, and you're a member of that team)
  2. Make a comment on your PR
  3. Click "Ready for review"
  4. See that you team IS NOT added

Fixed cases:

  1. Make a draft PR (in a repo where a team is always added, and you're a member of that team)
  2. Make a comment on your PR
  3. Click "Ready for review"
  4. See that you team IS added

Fixed cases:

  1. Make a draft PR (in a repo where a team is always added, and you're a member of that team)
  2. Have another team-member make a comment on your PR
  3. Click "Ready for review"
  4. See that you team IS added

Fixed cases:

  1. Make a draft PR (in a repo where a team is always added, and you're a member of that team)
  2. Have another team-member APPROVE or REJECT your PR
  3. Click "Ready for review"
  4. See that you team IS NOT added

Some test PRs:
https://github.com/Khan/our-lovely-cli/pull/673
https://github.com/Khan/our-lovely-cli/pull/674
https://github.com/Khan/our-lovely-cli/pull/675

@lillialexis lillialexis self-assigned this Jun 4, 2024
@lillialexis lillialexis changed the title [draft-bug] commenting out the buggy code to test it Fix a bug where Gerald doesn't add reviewers when the author comments and is on the reviewer team Jun 4, 2024
@lillialexis lillialexis changed the title Fix a bug where Gerald doesn't add reviewers when the author comments and is on the reviewer team Fix a bug where teams aren't added as reviewers when the author comments and the author is on the reviewer team Jun 4, 2024
@lillialexis lillialexis marked this pull request as ready for review June 4, 2024 19:56
@khan-actions-bot
Copy link
Contributor

Gerald

Required Reviewers
  • @Khan/github-actions for changes to dist/index.js, src/runOnPullRequest.js

Don't want to be involved in this pull request? Comment #removeme and we won't notify you of further changes.

Copy link
Member

@jeresig jeresig left a comment

Choose a reason for hiding this comment

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

Ahh - tricky, thank you!

@lillialexis lillialexis merged commit d3b5c01 into main Jun 5, 2024
9 checks passed
@lillialexis lillialexis deleted the draft-bug branch June 5, 2024 22:20
lillialexis added a commit to Khan/actions that referenced this pull request Jun 12, 2024
## Summary:
See [this PR](Khan/gerald#87) with a bug-fix regarding GitHub teams not getting added when author is a member of that team, and the author adds comments. Point this to that, once it's landed and tagged.

I also updated the README with instructions (mostly for myself, because I forgot what I did last time) on how to test PRs in this repo _before_ landing (and publishing).

Issue: XXX-XXXX

## Test plan:

Author: lillialexis

Reviewers: jeresig, lillialexis

Required Reviewers:

Approved By: jeresig

Checks: ✅ Lints, ✅ gerald

Pull Request URL: #91
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.

3 participants