diff --git a/.github/workflow-scripts/checkForReproducer.js b/.github/workflow-scripts/checkForReproducer.js index 1b8973b3c01407..50baff0d81c893 100644 --- a/.github/workflow-scripts/checkForReproducer.js +++ b/.github/workflow-scripts/checkForReproducer.js @@ -13,6 +13,7 @@ const NEEDS_REPRO_MESSAGE = `| :warning: | Missing Reproducible Example |\n` + `| --- | --- |\n` + `| :information_source: | We could not detect a reproducible example in your issue report. Please provide either:
|`; +const SKIP_ISSUES_OLDER_THAN = '2023-07-01T00:00:00Z'; module.exports = async (github, context) => { const issueData = { @@ -26,6 +27,11 @@ module.exports = async (github, context) => { const author = issue.data.user.login; + const issueDate = issue.data.created_at; + if (isDateBefore(issueDate, SKIP_ISSUES_OLDER_THAN)) { + return; + } + const maintainerChangedLabel = await hasMaintainerChangedLabel( github, issueData, @@ -108,3 +114,10 @@ async function hasMaintainerChangedLabel(github, issueData, author) { event.actor.login !== author && event.label.name === NEEDS_REPRO_LABEL, ); } + +function isDateBefore(firstDate, secondDate) { + const date1 = new Date(firstDate); + const date2 = new Date(secondDate); + + return date1.getTime() < date2.getTime(); +} diff --git a/.github/workflows/check-for-reproducer.yml b/.github/workflows/check-for-reproducer.yml index 36dc6200217c8f..97d841e7e6b7c3 100644 --- a/.github/workflows/check-for-reproducer.yml +++ b/.github/workflows/check-for-reproducer.yml @@ -1,14 +1,14 @@ name: Check for reproducer # This workflow is triggered when issue is created or edited. -# Also, when a comment is added, edited or deleted. on: issues: - types: [opened] + types: [opened, edited] jobs: check-for-reproducer: runs-on: ubuntu-latest - if: github.repository == 'facebook/react-native' && github.event.issue.pull_request == null && github.event.issue.state == 'open' + if: | + 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') steps: - uses: actions/checkout@v3 - uses: actions/github-script@v6