fix: split sync workflow into separate files to fix job skipping issue
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 <noreply@anthropic.com>
This commit is contained in:
parent
81f0072cb2
commit
3940e51299
4 changed files with 54 additions and 71 deletions
18
.github/workflows/sync-changes.yml
vendored
Normal file
18
.github/workflows/sync-changes.yml
vendored
Normal file
|
|
@ -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"
|
||||||
18
.github/workflows/sync-keyword.yml
vendored
Normal file
18
.github/workflows/sync-keyword.yml
vendored
Normal file
|
|
@ -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"
|
||||||
18
.github/workflows/sync-metrics.yml
vendored
Normal file
18
.github/workflows/sync-metrics.yml
vendored
Normal file
|
|
@ -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"
|
||||||
71
.github/workflows/sync.yml
vendored
71
.github/workflows/sync.yml
vendored
|
|
@ -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"
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue