From 4febe71d762b5535a8f39ae384f24fae0a92d6ee Mon Sep 17 00:00:00 2001 From: Ajax Davis Date: Wed, 3 Dec 2025 04:36:38 +1000 Subject: [PATCH] fix: split sync workflow into separate files to fix job skipping issue MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The previous combined workflow had flawed conditional logic that caused sync-keyword and sync-metrics jobs to be skipped. GitHub Actions doesn't populate github.event.schedule with the cron expression, so the equality checks never matched. Replaced with three separate workflow files: - sync-changes.yml: Runs every 2 minutes - sync-keyword.yml: Runs every 15 minutes - sync-metrics.yml: Runs every hour Each workflow can be manually triggered via workflow_dispatch. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- .github/workflows/sync-changes.yml | 18 ++++++++ .github/workflows/sync-keyword.yml | 18 ++++++++ .github/workflows/sync-metrics.yml | 18 ++++++++ .github/workflows/sync.yml | 71 ------------------------------ 4 files changed, 54 insertions(+), 71 deletions(-) create mode 100644 .github/workflows/sync-changes.yml create mode 100644 .github/workflows/sync-keyword.yml create mode 100644 .github/workflows/sync-metrics.yml delete mode 100644 .github/workflows/sync.yml diff --git a/.github/workflows/sync-changes.yml b/.github/workflows/sync-changes.yml new file mode 100644 index 0000000..fa2886e --- /dev/null +++ b/.github/workflows/sync-changes.yml @@ -0,0 +1,18 @@ +name: Sync NPM Changes Feed + +on: + schedule: + # Run every 2 minutes + - cron: '*/2 * * * *' + workflow_dispatch: + +jobs: + sync-changes: + runs-on: ubuntu-latest + steps: + - name: Trigger changes feed sync + run: | + curl -X POST "${{ secrets.VERCEL_PRODUCTION_URL }}/api/sync/changes" \ + -H "Authorization: Bearer ${{ secrets.CRON_SECRET }}" \ + -H "Content-Type: application/json" \ + -f -s -S -w "\nHTTP Status: %{http_code}\n" diff --git a/.github/workflows/sync-keyword.yml b/.github/workflows/sync-keyword.yml new file mode 100644 index 0000000..d4e9a82 --- /dev/null +++ b/.github/workflows/sync-keyword.yml @@ -0,0 +1,18 @@ +name: Sync NPM Keyword Search + +on: + schedule: + # Run every 15 minutes + - cron: '*/15 * * * *' + workflow_dispatch: + +jobs: + sync-keyword: + runs-on: ubuntu-latest + steps: + - name: Trigger keyword search sync + run: | + curl -X POST "${{ secrets.VERCEL_PRODUCTION_URL }}/api/sync/keyword" \ + -H "Authorization: Bearer ${{ secrets.CRON_SECRET }}" \ + -H "Content-Type: application/json" \ + -f -s -S -w "\nHTTP Status: %{http_code}\n" diff --git a/.github/workflows/sync-metrics.yml b/.github/workflows/sync-metrics.yml new file mode 100644 index 0000000..7bd5c40 --- /dev/null +++ b/.github/workflows/sync-metrics.yml @@ -0,0 +1,18 @@ +name: Sync NPM Metrics + +on: + schedule: + # Run every hour + - cron: '0 * * * *' + workflow_dispatch: + +jobs: + sync-metrics: + runs-on: ubuntu-latest + steps: + - name: Trigger metrics sync + run: | + curl -X POST "${{ secrets.VERCEL_PRODUCTION_URL }}/api/sync/metrics" \ + -H "Authorization: Bearer ${{ secrets.CRON_SECRET }}" \ + -H "Content-Type: application/json" \ + -f -s -S -w "\nHTTP Status: %{http_code}\n" diff --git a/.github/workflows/sync.yml b/.github/workflows/sync.yml deleted file mode 100644 index 5c6cd5a..0000000 --- a/.github/workflows/sync.yml +++ /dev/null @@ -1,71 +0,0 @@ -name: NPM Package Sync - -on: - schedule: - # Changes feed: Every 2 minutes - - cron: '*/2 * * * *' - # Keyword search: Every 15 minutes - - cron: '*/15 * * * *' - # Metrics: Every hour - - cron: '0 * * * *' - workflow_dispatch: - inputs: - sync_type: - description: 'Type of sync to run' - required: true - type: choice - options: - - changes - - keyword - - metrics - - all - -concurrency: - group: ${{ github.workflow }}-${{ github.event.inputs.sync_type || 'scheduled' }} - cancel-in-progress: false - -jobs: - sync-changes: - runs-on: ubuntu-latest - # Run on schedule every 2 minutes OR manual trigger with 'changes' or 'all' - if: | - github.event.schedule == '*/2 * * * *' || - github.event.inputs.sync_type == 'changes' || - github.event.inputs.sync_type == 'all' - steps: - - name: Trigger changes feed sync - run: | - curl -X POST "${{ secrets.VERCEL_PRODUCTION_URL }}/api/sync/changes" \ - -H "Authorization: Bearer ${{ secrets.CRON_SECRET }}" \ - -H "Content-Type: application/json" \ - -f -s -S -w "\nHTTP Status: %{http_code}\n" - - sync-keyword: - runs-on: ubuntu-latest - # Run on schedule every 15 minutes OR manual trigger with 'keyword' or 'all' - if: | - github.event.schedule == '*/15 * * * *' || - github.event.inputs.sync_type == 'keyword' || - github.event.inputs.sync_type == 'all' - steps: - - name: Trigger keyword search sync - run: | - curl -X POST "${{ secrets.VERCEL_PRODUCTION_URL }}/api/sync/keyword" \ - -H "Authorization: Bearer ${{ secrets.CRON_SECRET }}" \ - -H "Content-Type: application/json" \ - -f -s -S -w "\nHTTP Status: %{http_code}\n" - - sync-metrics: - runs-on: ubuntu-latest - # Run on schedule every hour OR manual trigger with 'metrics' or 'all' - if: | - github.event.schedule == '0 * * * *' || - github.event.inputs.sync_type == 'metrics' || - github.event.inputs.sync_type == 'all' - steps: - - name: Trigger metrics sync - run: | - curl -X POST "${{ secrets.VERCEL_PRODUCTION_URL }}/api/sync/metrics" \ - -H "Authorization: Bearer ${{ secrets.CRON_SECRET }}" \ - -H "Content-Type: application/json" \ - -f -s -S -w "\nHTTP Status: %{http_code}\n"