Skip to content

Commit 54d70cf

Browse files
Prevent check-for-reproducer action trigger on Umbrella and old issues (#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
1 parent 97ac793 commit 54d70cf

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

.github/workflow-scripts/checkForReproducer.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ const NEEDS_REPRO_MESSAGE =
1313
`| :warning: | Missing Reproducible Example |\n` +
1414
`| --- | --- |\n` +
1515
`| :information_source: | We could not detect a reproducible example in your issue report. Please provide either: <br /><ul><li>If your bug is UI related: a [Snack](https://snack.expo.dev)</li><li> If your bug is build/update related: use our [Reproducer Template](https://github.com/react-native-community/reproducer-react-native/generate). A reproducer needs to be in a GitHub repository under your username.</li></ul> |`;
16+
const SKIP_ISSUES_OLDER_THAN = '2023-07-01T00:00:00Z';
1617

1718
module.exports = async (github, context) => {
1819
const issueData = {
@@ -26,6 +27,11 @@ module.exports = async (github, context) => {
2627

2728
const author = issue.data.user.login;
2829

30+
const issueDate = issue.data.created_at;
31+
if (isDateBefore(issueDate, SKIP_ISSUES_OLDER_THAN)) {
32+
return;
33+
}
34+
2935
const maintainerChangedLabel = await hasMaintainerChangedLabel(
3036
github,
3137
issueData,
@@ -108,3 +114,10 @@ async function hasMaintainerChangedLabel(github, issueData, author) {
108114
event.actor.login !== author && event.label.name === NEEDS_REPRO_LABEL,
109115
);
110116
}
117+
118+
function isDateBefore(firstDate, secondDate) {
119+
const date1 = new Date(firstDate);
120+
const date2 = new Date(secondDate);
121+
122+
return date1.getTime() < date2.getTime();
123+
}

.github/workflows/check-for-reproducer.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
name: Check for reproducer
22
# This workflow is triggered when issue is created or edited.
3-
# Also, when a comment is added, edited or deleted.
43
on:
54
issues:
6-
types: [opened]
5+
types: [opened, edited]
76

87
jobs:
98
check-for-reproducer:
109
runs-on: ubuntu-latest
11-
if: github.repository == 'facebook/react-native' && github.event.issue.pull_request == null && github.event.issue.state == 'open'
10+
if: |
11+
github.repository == 'facebook/react-native' && github.event.issue.pull_request == null && github.event.issue.state == 'open' && !contains(github.event.issue.labels.*.name, ':open_umbrella: Umbrella')
1212
steps:
1313
- uses: actions/checkout@v3
1414
- uses: actions/github-script@v6

0 commit comments

Comments
 (0)