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"