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

☂️ Improving react-native-bot 🤖 #35591

Closed
7 of 11 tasks
kelset opened this issue Dec 7, 2022 · 12 comments
Closed
7 of 11 tasks

☂️ Improving react-native-bot 🤖 #35591

kelset opened this issue Dec 7, 2022 · 12 comments
Labels
Contributor A React Native contributor. Help Wanted :octocat: Issues ideal for external contributors. ☂️ Umbrella To label issues that serve as coordination point and drivers for tasks in the react-native repo p: Microsoft Partner: Microsoft Partner

Comments

@kelset
Copy link
Contributor

kelset commented Dec 7, 2022

What this is about

This umbrella issue wants to expand on some work that was started via this PR #35500 by @SlyCaptainFlint and on which we followed up with some conversations in the Discord with @cortinico.

The core goal is to improve the overall experience for both users and maintainers when interacting with the react-native repository, by leveraging "more and better" automations that are possible (mostly handled via the react-native-bot currently).

Ideas

In no particular order:

We'll be using this issue to refine the list above, adding, removing, and editing points as needed, to then lead to PRs to apply them in the future.

@facebook-github-bot facebook-github-bot added p: Microsoft Partner: Microsoft Partner Contributor A React Native contributor. labels Dec 7, 2022
@kelset kelset changed the title ☂️ Improving React Native bot 🤖 ☂️ Improving react-native-bot 🤖 Dec 7, 2022
@kelset kelset added ☂️ Umbrella To label issues that serve as coordination point and drivers for tasks in the react-native repo and removed Needs: Triage 🔍 labels Dec 7, 2022
@cortinico
Copy link
Contributor

On top of what you suggested @kelset:

  1. Auto-detect the Needs Repro like here: Hash/Fragment is stripped away on Web react-navigation/react-navigation#11026 (comment)
  2. Inspect of the environment/versions automatically like:
    Reuse screens inside different navigators with Typescript react-navigation/react-navigation#11028 (comment)

For context if folks want to start moving the logic from react-native-bot to Github Actions. The code of the old bot is inside: https://github.com/cortinico/react-native-bot
So once a feature has been ported to GH Actions, it should be removed/commented from that codebase so the two bots don't conflict each other

@kelset kelset added the Help Wanted :octocat: Issues ideal for external contributors. label Dec 7, 2022
@kelset
Copy link
Contributor Author

kelset commented Jul 10, 2023

@cortinico what do you think, do we still need this open?

@cortinico
Copy link
Contributor

@kelset I think yes, I've also added more items to the list for ideas we collected.

@kelset kelset pinned this issue Jul 11, 2023
@kacperkapusciak
Copy link
Contributor

@cortinico the source code for "Needs repro" action that we use in Reanimated, Gesture Hander and Screens repos can be found here: https://github.com/software-mansion-labs/swmansion-bot/tree/main/needs-repro

and an example of use:
https://github.com/software-mansion/react-native-reanimated/blob/main/.github/workflows/needs-repro.yml

In React Navigation, it's all in one YAML file which works great but it's a bit cumbersome to test and maintain: https://github.com/react-navigation/react-navigation/blob/main/.github/workflows/check-repro.yml

Cheers

@cortinico
Copy link
Contributor

@kacperkapusciak awesome, are you up for integrating it inside react-native?

@kacperkapusciak
Copy link
Contributor

@cortinico okay, I can spend some time on it

Would you like me to integrate our swmansion-bot/needs-repro action that we use as is (you can adjust the labels and the bot's response) or make it inline as you have here: https://github.com/facebook/react-native/blob/main/.github/workflows/close_pr.yml (full control of the code on your side).

Which one do you prefer?

@cortinico
Copy link
Contributor

or make it inline as you have here: main/.github/workflows/close_pr.yml (full control of the code on your side).

I think the best would be to have the logic inside https://github.com/facebook/react-native/tree/main/.github/workflow-scripts and copied over (for security reasons)

@kacperkapusciak
Copy link
Contributor

@cortinico seems reasonable, I'll submit a PR in the following days

@kacperkapusciak
Copy link
Contributor

@cortinico initial version is ready to check and open for discussion #38338

facebook-github-bot pushed a commit that referenced this issue Jul 19, 2023
Summary:
This PR adds a "check-for-reproducer" GitHub action proposed in #35591.
This GitHub action automatically labels an issue with when no link to GitHub repository under the authors name or link to Snack is present either in the issue body or in the comments.

## Changelog:

<!-- Help reviewers and the release process by writing your own changelog entry.

Pick one each for the category and type tags:

[ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message

For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->

[INTERNAL] [ADDED] - Add check-for-reproducer GitHub action

Pull Request resolved: #38338

Test Plan:
This action was tested on a private repro mimicking on how GitHub actions are set-up in `facebook/react-native` repository. If you'd want to play around with the action on this private repo just ask for access - provided you're a maintainer.

### Regarding issue body

1. Labels "Needs: Repro" when no link to Expo Snack or a Github repo under the author's name is present in the issue body:

![image](https://github.com/facebook/react-native/assets/39658211/b8e6d4aa-bc9a-471d-99b8-3b551f2c46c6)

2. Removes the "Needs: Repro" label and deletes the Missing Repro comment when the author edits the issue and provides a link to GitHub repo under their name

![image](https://github.com/facebook/react-native/assets/39658211/2dc13fae-b6ca-432f-88a2-f5c340f28c86)

3. Removes the "Needs: Repro" label and deletes the Missing Repro comment when the author edits the issue and provides a valid link to Expo Snack

![image](https://github.com/facebook/react-native/assets/39658211/e82e744e-b2fb-4979-84de-08f95686feb3)

### Regarding comments

3. Removes the "Needs: Repro" label and deletes the Missing Repro comment when there's a comment with a link to reproduction under issue author's name

![image](https://github.com/facebook/react-native/assets/39658211/eefb5978-29d3-4486-8bd7-878fb2c07c05)

4. Removes the "Needs: Repro" label and deletes the Missing Repro comment when there's a comment with a link to Expo Snack

![image](https://github.com/facebook/react-native/assets/39658211/5769ff77-0d9f-4dac-bb36-6d257e6c2a35)

### Regarding false-positives

5. Adds a "Needs: Repro" label when a link to reprository isn't under the issue author's name

![image](https://github.com/facebook/react-native/assets/39658211/01c93ea3-88b9-4920-a8f8-bcd123d214de)

6. Adds a "Needs: Repro" label when a link to Expo Snack's homepage was sent

![image](https://github.com/facebook/react-native/assets/39658211/568c9824-67af-402a-b102-c1c355651d21)

7. Adds a "Needs: Repro" label when a random link was sent

![image](https://github.com/facebook/react-native/assets/39658211/23bb58b3-cc07-4284-a562-6651f2077a3c)

Reviewed By: NickGerleman

Differential Revision: D47511745

Pulled By: cortinico

fbshipit-source-id: 2c0e5a989f52b4e50992a3954283f122b14153e0
juniorklawa pushed a commit to juniorklawa/react-native that referenced this issue Jul 20, 2023
Summary:
This PR adds a "check-for-reproducer" GitHub action proposed in facebook#35591.
This GitHub action automatically labels an issue with when no link to GitHub repository under the authors name or link to Snack is present either in the issue body or in the comments.

## Changelog:

<!-- Help reviewers and the release process by writing your own changelog entry.

Pick one each for the category and type tags:

[ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message

For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->

[INTERNAL] [ADDED] - Add check-for-reproducer GitHub action

Pull Request resolved: facebook#38338

Test Plan:
This action was tested on a private repro mimicking on how GitHub actions are set-up in `facebook/react-native` repository. If you'd want to play around with the action on this private repo just ask for access - provided you're a maintainer.

### Regarding issue body

1. Labels "Needs: Repro" when no link to Expo Snack or a Github repo under the author's name is present in the issue body:

![image](https://github.com/facebook/react-native/assets/39658211/b8e6d4aa-bc9a-471d-99b8-3b551f2c46c6)

2. Removes the "Needs: Repro" label and deletes the Missing Repro comment when the author edits the issue and provides a link to GitHub repo under their name

![image](https://github.com/facebook/react-native/assets/39658211/2dc13fae-b6ca-432f-88a2-f5c340f28c86)

3. Removes the "Needs: Repro" label and deletes the Missing Repro comment when the author edits the issue and provides a valid link to Expo Snack

![image](https://github.com/facebook/react-native/assets/39658211/e82e744e-b2fb-4979-84de-08f95686feb3)

### Regarding comments

3. Removes the "Needs: Repro" label and deletes the Missing Repro comment when there's a comment with a link to reproduction under issue author's name

![image](https://github.com/facebook/react-native/assets/39658211/eefb5978-29d3-4486-8bd7-878fb2c07c05)

4. Removes the "Needs: Repro" label and deletes the Missing Repro comment when there's a comment with a link to Expo Snack

![image](https://github.com/facebook/react-native/assets/39658211/5769ff77-0d9f-4dac-bb36-6d257e6c2a35)

### Regarding false-positives

5. Adds a "Needs: Repro" label when a link to reprository isn't under the issue author's name

![image](https://github.com/facebook/react-native/assets/39658211/01c93ea3-88b9-4920-a8f8-bcd123d214de)

6. Adds a "Needs: Repro" label when a link to Expo Snack's homepage was sent

![image](https://github.com/facebook/react-native/assets/39658211/568c9824-67af-402a-b102-c1c355651d21)

7. Adds a "Needs: Repro" label when a random link was sent

![image](https://github.com/facebook/react-native/assets/39658211/23bb58b3-cc07-4284-a562-6651f2077a3c)

Reviewed By: NickGerleman

Differential Revision: D47511745

Pulled By: cortinico

fbshipit-source-id: 2c0e5a989f52b4e50992a3954283f122b14153e0
facebook-github-bot pushed a commit that referenced this issue Jul 21, 2023
Summary:
This PR fixes a bug with an issue labeling bot issues triggering on comments to pull requests. The action doesn't trigger when a pull request is open (but other actions add comments immediately).

From [GitHub docs](https://docs.github.com/en/webhooks-and-events/events/issue-event-types):

> GitHub's REST API considers every pull request to be an issue, but not every issue is a pull request. [...] Pull requests have a **`pull_request` property in the `issue` object.**

☝️ Which is a way to differentiate between an issue and a pull request

Relates to a bug introduced in #38338 and links to ☂️#35591

## Changelog:

[INTERNAL] [FIXED] - Prevent issue bot triggering on pull requests

Pull Request resolved: #38525

Test Plan:
This PR makes use of  `github.event.issue.pull_request` object which is null on issues and comments in issues:

![image](https://github.com/facebook/react-native/assets/39658211/e0a64039-5fb7-4ad3-95aa-65cb7c9f0a4b)

and truthy on comments on pull requests

![image](https://github.com/facebook/react-native/assets/39658211/9df69d00-c792-4c00-bfc2-9ee832551d16)

With a change from PR bot skips execution on comments on pull requests

![image](https://github.com/facebook/react-native/assets/39658211/f02687fb-f81b-4278-8d0e-9b23651229c1)

Reviewed By: ryancat

Differential Revision: D47628330

Pulled By: cortinico

fbshipit-source-id: 63e7180bb57ffd34904414a702c02019e18a042b
facebook-github-bot pushed a commit that referenced this issue Jul 21, 2023
Summary:
This PR fixes a bug where GitHub Actions bot didn't add a comment when "Needs: Repro" label was present in an issue.

When a maintainer adds the label manually the bot comments with "Missing Reproductible Example" as normally.

It seems like the problem occurred because of a difference in a sandbox repository and the proper facebook/react-native repo environment.

My sandbox that I used to test #38338 had an "bot" account with Personal Access Token setup to reply to issues. Turns out that bots using PAT have more permissions and can trigger one action from the other.

**The solution is to send the comment directly from the `checkForReproducer` action.** This won't collide with other actions but sadly will duplicate the sending logic into two actions.

This PR also makes the bot respect when a maintainer removes and adds a label by hand and won't alter the maintainer decision.

Related to ☂️ #35591

## Changelog:

[INTERNAL] [FIXED] - Message

Pull Request resolved: #38531

Test Plan: ![image](https://github.com/facebook/react-native/assets/39658211/b956416f-9834-4c61-981f-fe6c17a5eec5)

Reviewed By: cipolleschi

Differential Revision: D47666922

Pulled By: cortinico

fbshipit-source-id: 4a6a471cb11c6ed9b48263d18bf8e283577a14bb
facebook-github-bot pushed a commit that referenced this issue Jul 28, 2023
#38664)

Summary:
This PR resolves problems with too spammy `check-for-reproducer` action triggering on very old and most prominently the Umbrella issues.

Also, it brings back triggering on edited issues removed in #38634

Related to #35591

## Changelog:

[INTERNAL] [FIXED] - Prevent check-for-reproducer action trigger on Umbrella and old issues

Pull Request resolved: #38664

Test Plan: <img width="470" alt="image" src="https://github.com/facebook/react-native/assets/39658211/1d840145-1e4f-43c5-a3ea-bc16e61071ef">

Reviewed By: cipolleschi

Differential Revision: D47868536

Pulled By: cortinico

fbshipit-source-id: fd78c38145c76f3867a41439aee5d087f38c85d2
billnbell pushed a commit to billnbell/react-native that referenced this issue Jul 29, 2023
facebook#38664)

Summary:
This PR resolves problems with too spammy `check-for-reproducer` action triggering on very old and most prominently the Umbrella issues.

Also, it brings back triggering on edited issues removed in facebook#38634

Related to facebook#35591

## Changelog:

[INTERNAL] [FIXED] - Prevent check-for-reproducer action trigger on Umbrella and old issues

Pull Request resolved: facebook#38664

Test Plan: <img width="470" alt="image" src="https://github.com/facebook/react-native/assets/39658211/1d840145-1e4f-43c5-a3ea-bc16e61071ef">

Reviewed By: cipolleschi

Differential Revision: D47868536

Pulled By: cortinico

fbshipit-source-id: fd78c38145c76f3867a41439aee5d087f38c85d2
billnbell pushed a commit to billnbell/react-native that referenced this issue Jul 29, 2023
facebook#38664)

Summary:
This PR resolves problems with too spammy `check-for-reproducer` action triggering on very old and most prominently the Umbrella issues.

Also, it brings back triggering on edited issues removed in facebook#38634

Related to facebook#35591

## Changelog:

[INTERNAL] [FIXED] - Prevent check-for-reproducer action trigger on Umbrella and old issues

Pull Request resolved: facebook#38664

Test Plan: <img width="470" alt="image" src="https://github.com/facebook/react-native/assets/39658211/1d840145-1e4f-43c5-a3ea-bc16e61071ef">

Reviewed By: cipolleschi

Differential Revision: D47868536

Pulled By: cortinico

fbshipit-source-id: fd78c38145c76f3867a41439aee5d087f38c85d2
billnbell pushed a commit to billnbell/react-native that referenced this issue Jul 29, 2023
facebook#38664)

Summary:
This PR resolves problems with too spammy `check-for-reproducer` action triggering on very old and most prominently the Umbrella issues.

Also, it brings back triggering on edited issues removed in facebook#38634

Related to facebook#35591

## Changelog:

[INTERNAL] [FIXED] - Prevent check-for-reproducer action trigger on Umbrella and old issues

Pull Request resolved: facebook#38664

Test Plan: <img width="470" alt="image" src="https://github.com/facebook/react-native/assets/39658211/1d840145-1e4f-43c5-a3ea-bc16e61071ef">

Reviewed By: cipolleschi

Differential Revision: D47868536

Pulled By: cortinico

fbshipit-source-id: fd78c38145c76f3867a41439aee5d087f38c85d2
@samitha9125
Copy link

@kelset I can help with Inspect of the environment/versions automatically. Basically, what I thought was to update the Issue template requesting versions of main packages that RN depends on. If they are not available, github bot will comment, just like the example provided in the initial description. Sounds good?

@samitha9125
Copy link

PR is ready to review. Feedbacks are welcome :) #40655

@kelset kelset unpinned this issue Oct 12, 2023
@cortinico
Copy link
Contributor

Closing as most of the issues here have been implemented 👍 We'll come up with another round of improvements whenever we feel there is the need for

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Contributor A React Native contributor. Help Wanted :octocat: Issues ideal for external contributors. ☂️ Umbrella To label issues that serve as coordination point and drivers for tasks in the react-native repo p: Microsoft Partner: Microsoft Partner
Projects
None yet
Development

No branches or pull requests

6 participants
@cortinico @facebook-github-bot @kelset @samitha9125 @kacperkapusciak and others