Skip to content

traffic-archive

traffic-archive #1

name: traffic-archive
on:
# Every Monday at 02:00 UTC (10:00 Beijing time)
schedule:
- cron: "0 2 * * 1"
# Allow manual runs (also used for the first backfill)
workflow_dispatch:
inputs:
mode:
description: "Run mode"
required: true
default: "weekly"
type: choice
options:
- weekly
- backfill
jobs:
archive:
runs-on: ubuntu-latest
env:
# choice-typed input is constrained to "weekly" or "backfill";
# falls back to "weekly" on scheduled runs where input is absent.
INPUT_MODE: ${{ inputs.mode }}
GH_TOKEN: ${{ secrets.TRAFFIC_PAT }}
SOURCE_REPO: ${{ github.repository }}
TARGET_REPO: TencentEdgeOne/edgeone-pages-skills-traffic
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20"
- name: Archive traffic stats
run: |
export MODE="${INPUT_MODE:-weekly}"
node scripts/archive-traffic.mjs