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

Sync product area labels with GH project containing all issues #460

Merged

Conversation

hubertdeng123
Copy link
Member

@hubertdeng123 hubertdeng123 commented May 23, 2023

This PR adds three main things:

  1. Instead of setting up GitHub project automation to do this, eng-pipes bot will add issues to the Issues Someone Else Cares About project when GTM, support, or outside Sentry org members create issues.
  2. Whenever Product Area: * label is added to an issue, it will be added to the Issues Someone Else Cares About project if it's not already there. After, the Product Area: * label will be synced with the Product Area field on the project.
  3. Whenever the Product Area field changes, the corresponding Product Area: * label is added to an issue

Demo:

Screen.Recording.2023-05-24.at.10.53.05.AM.mov

@hubertdeng123
Copy link
Member Author

We'll need to check to make sure the getsantry bot has appropriate permissions for GitHub projects (read and write)

@hubertdeng123 hubertdeng123 marked this pull request as ready for review May 24, 2023 18:55
@hubertdeng123 hubertdeng123 changed the title Draft: Sync product area labels with GH project containing all issues Sync product area labels with GH project containing all issues May 24, 2023
@chadwhitacre
Copy link
Member

Demo looks great. Does the product area sync go the other way? If you modify the project field does the label change? What happens if you add a second product area label? Are there race conditions?

@hubertdeng123
Copy link
Member Author

The product area sync does not go the other way, as far as I could gather there doesn't seem to be anything for GitHub events for project. Link to GitHub events

In a rerouting scenario, if a second product area label is added, the first product area label is removed. The bot will also change the project field to be the product area of the second product area label. Demo below

Screen.Recording.2023-05-24.at.2.31.31.PM.mov

@chadwhitacre
Copy link
Member

The product area sync does not go the other way, as far as I could gather there doesn't seem to be anything for GitHub events for project.

Oof, that's rough. Can we reach out to GitHub in our shared Slack channel to see if there are any workarounds besides polling? It feels like this is going to be a pretty common case and we don't want to get out of sync.

@hubertdeng123
Copy link
Member Author

actually, looks like there is something I can work with:
https://docs.github.com/en/webhooks-and-events/webhooks/webhook-events-and-payloads?actionType=edited#projects_v2

Going to take some time and investigate this today

@codecov
Copy link

codecov bot commented May 26, 2023

Codecov Report

❗ No coverage uploaded for pull request base (main@6d33486). Click here to learn what that means.
Patch has no changes to coverable lines.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #460   +/-   ##
=======================================
  Coverage        ?   82.52%           
=======================================
  Files           ?       96           
  Lines           ?     2386           
  Branches        ?      462           
=======================================
  Hits            ?     1969           
  Misses          ?      411           
  Partials        ?        6           

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@hubertdeng123
Copy link
Member Author

hubertdeng123 commented May 26, 2023

If you modify the project field does the label change?

Now done

Screen.Recording.2023-05-26.at.12.22.03.PM.mov

Are there race conditions?

I did notice one if I switch between Product Area fields extremely fast on the project. It might be due to the delay when applying a label to the issue once a Product Area field value is set. It requires a user to change the Product Area field between different values in ~1 second or less. I played around and couldn't find a trivial fix for it, but it does seem to be something of a lesser priority to tackle given how hard it is to replicate

src/config/index.ts Outdated Show resolved Hide resolved
@hubertdeng123 hubertdeng123 force-pushed the hubertdeng123/sync-product-area-labels-with-project branch from ffc8736 to d77cb7d Compare May 30, 2023 21:56
@hubertdeng123 hubertdeng123 force-pushed the hubertdeng123/sync-product-area-labels-with-project branch from e1ccac1 to 8c0f37b Compare May 31, 2023 17:57
Copy link
Member

@chadwhitacre chadwhitacre left a comment

Choose a reason for hiding this comment

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

Ship it!

@hubertdeng123 hubertdeng123 merged commit 8e3873a into main May 31, 2023
@hubertdeng123 hubertdeng123 deleted the hubertdeng123/sync-product-area-labels-with-project branch May 31, 2023 21:34
return;
}

const owner = payload?.organization?.login || '';
Copy link
Member

Choose a reason for hiding this comment

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

Coming here from #524 ... I'm wondering why we default to the empty string here. I doubt an App octokit loaded with an empty org would work. I think we should let an exception bubble up if payload.organization.login does not exist.

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