From 9b0eabecb16a68180e7cec084767efbcce2ee69e Mon Sep 17 00:00:00 2001 From: Kevin Heis Date: Thu, 10 Nov 2022 08:40:48 -0800 Subject: [PATCH] Standardize workflow run crons (#32488) --- .../check-broken-links-github-github.yml | 2 +- .github/workflows/docs-review-collect.yml | 2 +- .github/workflows/enterprise-dates.yml | 2 +- .github/workflows/link-check-daily.yml | 2 +- .../msft-create-translation-batch-pr.yml | 2 +- .github/workflows/needs-sme-stale-check.yaml | 2 +- .github/workflows/no-response.yaml | 3 +-- .github/workflows/open-enterprise-issue.yml | 2 +- .github/workflows/orphaned-assets-check.yml | 2 +- .github/workflows/repo-sync-stalls.yml | 2 +- .github/workflows/repo-sync.yml | 2 +- .github/workflows/stale.yml | 2 +- .github/workflows/sync-search-elasticsearch.yml | 2 +- .github/workflows/test-translations.yml | 2 +- .github/workflows/triage-stale-check.yml | 2 +- .github/workflows/update-graphql-files.yml | 2 +- tests/unit/actions-workflows.js | 16 +++++++--------- 17 files changed, 23 insertions(+), 26 deletions(-) diff --git a/.github/workflows/check-broken-links-github-github.yml b/.github/workflows/check-broken-links-github-github.yml index 12af9405a9..e1c58351b1 100644 --- a/.github/workflows/check-broken-links-github-github.yml +++ b/.github/workflows/check-broken-links-github-github.yml @@ -7,7 +7,7 @@ name: Check Broken Docs Links in github/github on: workflow_dispatch: schedule: - - cron: '20 13 * * 1' # run every Monday at 1:20PM UTC + - cron: '20 16 * * 1' # Run every Monday at 16:20 UTC / 8:20 PST permissions: contents: read diff --git a/.github/workflows/docs-review-collect.yml b/.github/workflows/docs-review-collect.yml index c919a2879a..1d21260505 100644 --- a/.github/workflows/docs-review-collect.yml +++ b/.github/workflows/docs-review-collect.yml @@ -7,7 +7,7 @@ name: Add docs-reviewers request to the docs-content review board on: workflow_dispatch: schedule: - - cron: '50 */6 * * *' + - cron: '20 */6 * * *' # Run every 6 hours at 20 minutes after permissions: contents: read diff --git a/.github/workflows/enterprise-dates.yml b/.github/workflows/enterprise-dates.yml index bc19de3903..00e6a54056 100644 --- a/.github/workflows/enterprise-dates.yml +++ b/.github/workflows/enterprise-dates.yml @@ -9,7 +9,7 @@ name: Enterprise date updater on: workflow_dispatch: schedule: - - cron: '39 2 * * 2' # At 02:39 on Tuesday + - cron: '20 16 * * 2' # Run every Tuesday at 16:20 UTC / 8:20 PST permissions: contents: write diff --git a/.github/workflows/link-check-daily.yml b/.github/workflows/link-check-daily.yml index 623bef0fd2..be9aabf207 100644 --- a/.github/workflows/link-check-daily.yml +++ b/.github/workflows/link-check-daily.yml @@ -7,7 +7,7 @@ name: 'Link Checker: Daily' on: workflow_dispatch: schedule: - - cron: '40 19 * * *' # once a day at 19:40 UTC / 11:40 PST + - cron: '20 16 * * *' # Run every day at 16:20 UTC / 8:20 PST permissions: contents: read diff --git a/.github/workflows/msft-create-translation-batch-pr.yml b/.github/workflows/msft-create-translation-batch-pr.yml index 90ca575913..c3fe40c5e8 100644 --- a/.github/workflows/msft-create-translation-batch-pr.yml +++ b/.github/workflows/msft-create-translation-batch-pr.yml @@ -11,7 +11,7 @@ name: Create translation Batch Pull Request (Microsoft) on: workflow_dispatch: schedule: - - cron: '02 17 * * *' # Once a day at 17:02 UTC / 9:02 PST + - cron: '20 16 * * *' # Run every day at 16:20 UTC / 8:20 PST permissions: contents: write diff --git a/.github/workflows/needs-sme-stale-check.yaml b/.github/workflows/needs-sme-stale-check.yaml index 3c8f8f8d53..45abf74f76 100644 --- a/.github/workflows/needs-sme-stale-check.yaml +++ b/.github/workflows/needs-sme-stale-check.yaml @@ -6,7 +6,7 @@ name: Stale check for issues or PRs with "needs SME" label on: schedule: - - cron: '40 20 * * *' # Run each day at 20:40 UTC / 12:40 PST + - cron: '20 16 * * *' # Run each day at 16:20 UTC / 8:20 PST permissions: issues: write diff --git a/.github/workflows/no-response.yaml b/.github/workflows/no-response.yaml index 2c3ade37b5..0e49672847 100644 --- a/.github/workflows/no-response.yaml +++ b/.github/workflows/no-response.yaml @@ -12,8 +12,7 @@ on: types: [created] schedule: - # Schedule for five minutes after the hour every hour - - cron: '5 * * * *' + - cron: '20 * * * *' # Run each hour at 20 minutes past permissions: issues: write diff --git a/.github/workflows/open-enterprise-issue.yml b/.github/workflows/open-enterprise-issue.yml index dd242bd687..814536e778 100644 --- a/.github/workflows/open-enterprise-issue.yml +++ b/.github/workflows/open-enterprise-issue.yml @@ -7,7 +7,7 @@ name: Open Enterprise release or deprecation issue on: workflow_dispatch: schedule: - - cron: '49 14 * * *' # At 14:49 UTC daily + - cron: '20 16 * * *' # Run every day at 16:20 UTC / 8:20 PST permissions: contents: read diff --git a/.github/workflows/orphaned-assets-check.yml b/.github/workflows/orphaned-assets-check.yml index fac6ad08c4..ee5076a950 100644 --- a/.github/workflows/orphaned-assets-check.yml +++ b/.github/workflows/orphaned-assets-check.yml @@ -7,7 +7,7 @@ name: 'Orphaned assets check' on: workflow_dispatch: schedule: - - cron: '20 11 * * 1' # run every Monday at 11:20AM UTC + - cron: '20 16 * * 1' # Run every Monday at 16:20 UTC / 8:20 PST permissions: contents: read diff --git a/.github/workflows/repo-sync-stalls.yml b/.github/workflows/repo-sync-stalls.yml index f233567651..09ff02e1e2 100644 --- a/.github/workflows/repo-sync-stalls.yml +++ b/.github/workflows/repo-sync-stalls.yml @@ -7,7 +7,7 @@ name: Repo Sync Stalls on: workflow_dispatch: schedule: - - cron: '32 */2 * * *' # At minute 32 past every 2nd hour. + - cron: '20 */2 * * *' # Run every 2nd hour at 20 minutes after permissions: pull-requests: read diff --git a/.github/workflows/repo-sync.yml b/.github/workflows/repo-sync.yml index 86e2f4bcd7..569a689349 100644 --- a/.github/workflows/repo-sync.yml +++ b/.github/workflows/repo-sync.yml @@ -18,7 +18,7 @@ name: Repo Sync on: workflow_dispatch: schedule: - - cron: '10,40 * * * *' # every 30 minutes + - cron: '20,50 * * * *' # Run every hour at 20 and 50 minutes after permissions: contents: write diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index 29ebe4a6d2..bd4787d680 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -6,7 +6,7 @@ name: Stale on: schedule: - - cron: '40 16 * * *' # Run each day at 16:40 UTC / 8:40 PST + - cron: '20 16 * * *' # Run every day at 16:20 UTC / 8:20 PST permissions: issues: write diff --git a/.github/workflows/sync-search-elasticsearch.yml b/.github/workflows/sync-search-elasticsearch.yml index 29543f3348..7b41755180 100644 --- a/.github/workflows/sync-search-elasticsearch.yml +++ b/.github/workflows/sync-search-elasticsearch.yml @@ -13,7 +13,7 @@ on: required: false default: '' schedule: - - cron: '23 */4 * * *' # Run every 4 hours at 23 minutes past the hour + - cron: '20 */4 * * *' # Run every 4 hours at 20 minutes after permissions: contents: read diff --git a/.github/workflows/test-translations.yml b/.github/workflows/test-translations.yml index f5412aa74b..ec58f6f0c6 100644 --- a/.github/workflows/test-translations.yml +++ b/.github/workflows/test-translations.yml @@ -7,7 +7,7 @@ name: Translations tests on: workflow_dispatch: schedule: - - cron: '35 16 * * *' # Run once per day at 16:35 UTC / 9:35 PST + - cron: '20 16 * * *' # Run every day at 16:20 UTC / 9:20 PST permissions: contents: read diff --git a/.github/workflows/triage-stale-check.yml b/.github/workflows/triage-stale-check.yml index 7c28c7dde2..c9584a0d97 100644 --- a/.github/workflows/triage-stale-check.yml +++ b/.github/workflows/triage-stale-check.yml @@ -6,7 +6,7 @@ name: Public Repo Stale Check on: schedule: - - cron: '45 16 * * *' # Run each day at 16:45 UTC / 8:45 PST + - cron: '20 16 * * *' # Run every day at 16:20 UTC / 8:20 PST permissions: issues: write diff --git a/.github/workflows/update-graphql-files.yml b/.github/workflows/update-graphql-files.yml index 281baa3ad3..fcc08c1eca 100644 --- a/.github/workflows/update-graphql-files.yml +++ b/.github/workflows/update-graphql-files.yml @@ -7,7 +7,7 @@ name: Update GraphQL files on: workflow_dispatch: schedule: - - cron: '20 16 * * *' # run every day at 16:20 UTC / 8:20 PST + - cron: '20 16 * * *' # Run every day at 16:20 UTC / 8:20 PST permissions: contents: write diff --git a/tests/unit/actions-workflows.js b/tests/unit/actions-workflows.js index 143f4b8391..d0cbc9e2ab 100644 --- a/tests/unit/actions-workflows.js +++ b/tests/unit/actions-workflows.js @@ -39,16 +39,14 @@ describe('GitHub Actions workflows', () => { expect(actionName).toMatch(actionRegexp) }) - test('no scheduled workflows run on the hour', () => { - const hourlySchedules = scheduledWorkflows.filter((schedule) => { - const hour = schedule.split(' ')[0] - // return any minute cron segments that equal 0, 00, 000, etc. - return !/[^0]/.test(hour) - }) - expect(hourlySchedules).toEqual([]) + test('all scheduled workflows run at 20 minutes past', () => { + const twenties = scheduledWorkflows.filter((schedule) => /^20/.test(schedule)) + expect(twenties.length).toEqual(scheduledWorkflows.length) }) - test('all scheduled workflows run at unique times', () => { - expect(scheduledWorkflows.length).toEqual(new Set(scheduledWorkflows).size) + test('all daily and weekly workflows run at 16:20 UTC / 8:20 PST', () => { + const dailies = scheduledWorkflows.filter((schedule) => /^20 \d{2}/.test(schedule)) + const sixteens = dailies.filter((schedule) => /^20 16/.test(schedule)) + expect(sixteens.length).toEqual(dailies.length) }) })