From 5705661d1f8f806a2a87336fe5b36e89d20aa80d Mon Sep 17 00:00:00 2001 From: kacperkapusciak Date: Fri, 21 Jul 2023 03:10:12 -0700 Subject: [PATCH] Fix issue bot triggering on PRs (#38525) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 https://github.com/facebook/react-native/pull/38338 and links to ☂️https://github.com/facebook/react-native/issues/35591 ## Changelog: [INTERNAL] [FIXED] - Prevent issue bot triggering on pull requests Pull Request resolved: https://github.com/facebook/react-native/pull/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 --- .github/workflows/check-for-reproducer.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check-for-reproducer.yml b/.github/workflows/check-for-reproducer.yml index 76d347cfa6bfad..d15628a20585a4 100644 --- a/.github/workflows/check-for-reproducer.yml +++ b/.github/workflows/check-for-reproducer.yml @@ -10,7 +10,7 @@ on: jobs: check-for-reproducer: runs-on: ubuntu-latest - if: github.repository == 'facebook/react-native' + if: github.repository == 'facebook/react-native' && github.event.issue.pull_request == null steps: - uses: actions/checkout@v3 - uses: actions/github-script@v6