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

Prevent check-for-reproducer action trigger on Umbrella and old issues #38664

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .github/workflow-scripts/checkForReproducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: <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> |`;
const SKIP_ISSUES_OLDER_THAN = '2023-07-01T00:00:00Z';

module.exports = async (github, context) => {
const issueData = {
Expand All @@ -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,
Expand Down Expand Up @@ -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();
}
6 changes: 3 additions & 3 deletions .github/workflows/check-for-reproducer.yml
Original file line number Diff line number Diff line change
@@ -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
Expand Down