From 74ff18c0e26693ba0d0deb1d52c814dd6f291ac5 Mon Sep 17 00:00:00 2001 From: Timur Olzhabayev Date: Fri, 29 Dec 2023 15:30:48 +0100 Subject: [PATCH] run on schedule too --- .github/workflows/feature-toggle-cleanup.yml | 6 ++++-- .../feature-toggle-cleanup/feature-toggle-cleanup.mjs | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/feature-toggle-cleanup.yml b/.github/workflows/feature-toggle-cleanup.yml index fc07e63..88a7703 100644 --- a/.github/workflows/feature-toggle-cleanup.yml +++ b/.github/workflows/feature-toggle-cleanup.yml @@ -1,8 +1,10 @@ name: Feature Toggle Cleanup on: - workflow_dispatch: - + workflow_dispatch: + schedule: + # * is a special character in YAML so you have to quote this string + - cron: '30 10 * * *' jobs: fetch: runs-on: ubuntu-latest diff --git a/.github/workflows/scripts/feature-toggle-cleanup/feature-toggle-cleanup.mjs b/.github/workflows/scripts/feature-toggle-cleanup/feature-toggle-cleanup.mjs index 6db3713..35bc293 100644 --- a/.github/workflows/scripts/feature-toggle-cleanup/feature-toggle-cleanup.mjs +++ b/.github/workflows/scripts/feature-toggle-cleanup/feature-toggle-cleanup.mjs @@ -26,11 +26,11 @@ export default function cleanupFeatureFlags() { cast_date: true, }); - console.log('sixMonthAgo', sixMonthAgo); + // Here we can have the custom logic of how to handle what type of feature flag - e.g. GA can be treated differently than experimental and so on. for (const flag of parsedFeatureFlags) { - console.log(flag); if (flag.Created < sixMonthAgo) { console.log(`The flag ${flag.Name} was created more than 6 months ago. It should be checked.`); + console.log(flag); } }