mirror of
https://github.com/facebook/react-native.git
synced 2026-11-18 20:19:07 +00:00
Retire new-issue Discord monitor workflow (#59499)
Summary: Retire the scheduled "Monitor React Native New Issues" workflow. It polls for new GitHub issues every six hours and posts notifications to Discord, mentioning two rotating on-call users. The user has decided to stop this monitoring entirely, so remove the workflow together with its dedicated on-call parser and tests. User-visible effect: the workflow will no longer post new-issue notifications to Discord or ping the on-call users. GitHub issues themselves are unaffected. This supersedes https://github.com/react/react-native/issues/58871, which attempted to repair the expired on-call schedule. ## Changelog: [INTERNAL] [REMOVED] - Retire the new-issue Discord notification workflow. Pull Request resolved: https://github.com/react/react-native/pull/59499 Test Plan: - `git diff --check` — passed. - Searched .github, scripts, and packages for references to the workflow, ONCALL_SCHEDULE, and extractIssueOncalls — none remain. - `yarn test .github/workflow-scripts/__tests__ --runInBand` — 12 suites passed (73 tests); 2 unrelated visual suites could not start because the local checkout lacks the `pngjs` dependency. No dependency install was performed because yarn install changes the working tree. - GitHub Actions should confirm the deleted workflow does not run on the PR; no UI changes. Reviewed By: christophpurrer Differential Revision: D127584085 Pulled By: cortinico fbshipit-source-id: 44b786c0f042aa955a840f90814a5f08ccee656c
This commit is contained in:
1 parent
6dcc04bf21
commit
9c8a368067
3 files changed
-210
No files matched your search
@@ -1,83 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @format
|
||||
*/
|
||||
|
||||
const {extractIssueOncalls} = require('../extractIssueOncalls');
|
||||
|
||||
const userMap = {
|
||||
'@g': '1785',
|
||||
'@c': '1781',
|
||||
'@s': '1272',
|
||||
'@d': '1332',
|
||||
'@m': '9555',
|
||||
'@p': '6097',
|
||||
'@f': '7565',
|
||||
};
|
||||
|
||||
const schedule = {
|
||||
'2025-04-01': ['@m', '@f'],
|
||||
'2025-04-08': ['@g', '@d'],
|
||||
};
|
||||
|
||||
describe('extractIssueOncalls', () => {
|
||||
beforeEach(() => {
|
||||
jest.clearAllMocks();
|
||||
jest.useFakeTimers('modern');
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
jest.useRealTimers();
|
||||
});
|
||||
it('extracts m and f on 6 of April', () => {
|
||||
jest.setSystemTime(new Date(2025, 3, 6));
|
||||
const oncalls = extractIssueOncalls(schedule, userMap);
|
||||
expect(oncalls).toEqual([userMap['@m'], userMap['@f']]);
|
||||
});
|
||||
|
||||
it('extracts m and f on 7 of April', () => {
|
||||
jest.setSystemTime(new Date(2025, 3, 7));
|
||||
const oncalls = extractIssueOncalls(schedule, userMap);
|
||||
expect(oncalls).toEqual([userMap['@m'], userMap['@f']]);
|
||||
});
|
||||
|
||||
it('extracts g and d on 8 of April', () => {
|
||||
jest.setSystemTime(new Date(2025, 3, 8));
|
||||
const oncalls = extractIssueOncalls(schedule, userMap);
|
||||
expect(oncalls).toEqual([userMap['@g'], userMap['@d']]);
|
||||
});
|
||||
|
||||
it('extracts g and d on 9 of April', () => {
|
||||
jest.setSystemTime(new Date(2025, 3, 9));
|
||||
const oncalls = extractIssueOncalls(schedule, userMap);
|
||||
expect(oncalls).toEqual([userMap['@g'], userMap['@d']]);
|
||||
});
|
||||
|
||||
it('extracts g and d on 10 of April', () => {
|
||||
jest.setSystemTime(new Date(2025, 3, 10));
|
||||
const oncalls = extractIssueOncalls(schedule, userMap);
|
||||
expect(oncalls).toEqual([userMap['@g'], userMap['@d']]);
|
||||
});
|
||||
|
||||
it('extracts g and d on 11 of April', () => {
|
||||
jest.setSystemTime(new Date(2025, 3, 11));
|
||||
const oncalls = extractIssueOncalls(schedule, userMap);
|
||||
expect(oncalls).toEqual([userMap['@g'], userMap['@d']]);
|
||||
});
|
||||
|
||||
it('extracts g and d on 12 of April', () => {
|
||||
jest.setSystemTime(new Date(2025, 3, 12));
|
||||
const oncalls = extractIssueOncalls(schedule, userMap);
|
||||
expect(oncalls).toEqual([userMap['@g'], userMap['@d']]);
|
||||
});
|
||||
|
||||
it('extracts g and d on 13 of April', () => {
|
||||
jest.setSystemTime(new Date(2025, 3, 13));
|
||||
const oncalls = extractIssueOncalls(schedule, userMap);
|
||||
expect(oncalls).toEqual([userMap['@g'], userMap['@d']]);
|
||||
});
|
||||
});
|
||||
@@ -1,86 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @format
|
||||
*/
|
||||
|
||||
const fs = require('fs');
|
||||
|
||||
const MSEC_IN_DAY = 1000 * 60 * 60 * 24;
|
||||
|
||||
function formatUsers(users) {
|
||||
console.log(`${users[0]} ${users[1]}`.trim());
|
||||
}
|
||||
|
||||
function extractUsersFromScheduleAndDate(schedule, userMap, date) {
|
||||
const year = date.getFullYear();
|
||||
const month = date.getMonth() + 1; // 0 is January, 1 is February
|
||||
const day = date.getDate();
|
||||
const dateStr = `${year}-${month < 10 ? `0${month}` : month}-${day < 10 ? `0${day}` : day}`;
|
||||
const user1 = userMap[schedule[dateStr][0]];
|
||||
const user2 = userMap[schedule[dateStr][1]];
|
||||
return [user1, user2];
|
||||
}
|
||||
|
||||
/**
|
||||
* You can invoke this script by doing:
|
||||
* ```
|
||||
* node .github/workflow-scripts/extractIssueOncalls.js $DATA
|
||||
* ```
|
||||
*
|
||||
* the $DATA is stored in the github secrets as ONCALL_SCHEDULE variable.
|
||||
* The format of the data is:
|
||||
* ```
|
||||
* {
|
||||
* \"userMap\": {
|
||||
* \"discord_handle1\": \"discord_id1\",
|
||||
* \"discord_handle2\": \"discord_id2\",
|
||||
* ...
|
||||
* },
|
||||
* \"schedule\": {
|
||||
* \"2025-07-29\": [\"discord_handle1\", \"discord_handle2\"],
|
||||
* \"2025-08-05\": [\"discord_handle3\", \"discord_handle4\"],
|
||||
* ...
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* When uploading the secret, make sure that the JSON strings are escaped!
|
||||
* The script will fail otherwise, because GitHub will remove the `"` characters.
|
||||
*/
|
||||
function main() {
|
||||
const configuration = process.argv[2];
|
||||
const {userMap, schedule} = JSON.parse(configuration);
|
||||
extractIssueOncalls(schedule, userMap);
|
||||
}
|
||||
|
||||
function extractIssueOncalls(schedule, userMap) {
|
||||
const now = new Date();
|
||||
const dayOfTheWeek = now.getDay(); // 0 is Sunday, 1 is Monday, etc.
|
||||
let users;
|
||||
if (dayOfTheWeek === 2) {
|
||||
// exact match in the schedule
|
||||
users = extractUsersFromScheduleAndDate(schedule, userMap, now);
|
||||
} else if (dayOfTheWeek < 2) {
|
||||
// sunday
|
||||
// go to the tuesday of the last week
|
||||
const lastWeekTuesday = new Date(now - (5 + dayOfTheWeek) * MSEC_IN_DAY);
|
||||
users = extractUsersFromScheduleAndDate(schedule, userMap, lastWeekTuesday);
|
||||
} else if (dayOfTheWeek > 1) {
|
||||
// go to the previous tuesday
|
||||
const thisWeekTuesday = new Date(now - (dayOfTheWeek - 2) * MSEC_IN_DAY);
|
||||
users = extractUsersFromScheduleAndDate(schedule, userMap, thisWeekTuesday);
|
||||
}
|
||||
formatUsers(users);
|
||||
return users;
|
||||
}
|
||||
|
||||
if (require.main === module) {
|
||||
void main();
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
extractIssueOncalls,
|
||||
};
|
||||
@@ -1,41 +0,0 @@
|
||||
name: Monitor React Native New Issues
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: '0 0,6,12,18 * * *'
|
||||
workflow_dispatch:
|
||||
|
||||
# Reminder for when we have to update the schedule (before Jan 2026):
|
||||
# the secrets.ONCALL_SCHEDULE secret must be on a single line and must have all the `"` escaped as `\"`.
|
||||
# Only a meta engineer can update it through the OSS internal portal.
|
||||
|
||||
jobs:
|
||||
monitor-issues:
|
||||
runs-on: ubuntu-latest
|
||||
if: github.repository == 'react/react-native'
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v6
|
||||
- name: Set up Node.js
|
||||
uses: ./.github/actions/setup-node
|
||||
- name: Install dependencies
|
||||
uses: ./.github/actions/yarn-install
|
||||
- name: Extract next oncall
|
||||
run: |
|
||||
ONCALLS=$(node ./.github/workflow-scripts/extractIssueOncalls.js "${{ secrets.ONCALL_SCHEDULE }}")
|
||||
ONCALL1=$(echo $ONCALLS | cut -d ' ' -f 1)
|
||||
ONCALL2=$(echo $ONCALLS | cut -d ' ' -f 2)
|
||||
echo "oncall1=$ONCALL1" >> $GITHUB_ENV
|
||||
echo "oncall2=$ONCALL2" >> $GITHUB_ENV
|
||||
- name: Monitor New Issues
|
||||
uses: react-native-community/repo-monitor@v1.0.1
|
||||
with:
|
||||
task: 'monitor-issues'
|
||||
git_secret: ${{ secrets.GITHUB_TOKEN }}
|
||||
notifier: 'discord'
|
||||
fetch_data_interval: 6
|
||||
repo_owner: 'react'
|
||||
repo_name: 'react-native'
|
||||
discord_webhook_url: '${{ secrets.DISCORD_WEBHOOK_URL }}'
|
||||
discord_id_type: 'user'
|
||||
discord_ids: '${{ env.oncall1 }},${{ env.oncall2 }}'
|
||||
Reference in new issue
Block a user