From 0e4173814d1e2c95aff5d93847d7c8b60a9220b0 Mon Sep 17 00:00:00 2001 From: Kiko Beats Date: Wed, 28 Oct 2026 18:14:29 +0100 Subject: [PATCH 1/3] ci: add weekly cron to refresh headers-order.json Same shape as country-vat: run the postinstall fetcher, gate on the test suite, commit `build(update): headers order` only when the file changed, push with GH_TOKEN so main.yml releases the new data. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/cron.yml | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 .github/workflows/cron.yml diff --git a/.github/workflows/cron.yml b/.github/workflows/cron.yml new file mode 100644 index 0000000..6fa546d --- /dev/null +++ b/.github/workflows/cron.yml @@ -0,0 +1,36 @@ +name: cron + +on: + workflow_dispatch: + schedule: + # Cron job every Monday at 12:00 + # https://crontab.guru/every-monday + - cron: '0 0 * * MON' + +jobs: + test: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v7 + with: + token: ${{ secrets.GH_TOKEN }} + - name: Setup Node.js + uses: actions/setup-node@v7 + with: + node-version: lts/* + - name: Setup PNPM + uses: pnpm/action-setup@v6 + with: + version: latest + - name: Install + run: pnpm install --dangerously-allow-all-builds + - name: Cron + run: | + git config --global user.email ${{ secrets.GIT_EMAIL }} + git config --global user.name ${{ secrets.GIT_USERNAME }} + npm run postinstall + npm test + git add src/headers-order.json + git diff-index --quiet HEAD || git commit -m 'build(update): headers order' --no-verify + git push origin HEAD From 6903fe59ea0f0aba1e537ed424ee305bd700a7be Mon Sep 17 00:00:00 2001 From: Kiko Beats Date: Wed, 28 Oct 2026 18:15:40 +0100 Subject: [PATCH 2/3] ci(cron): ping healthcheck after update Co-Authored-By: Claude Opus 5.5 --- .github/workflows/cron.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/cron.yml b/.github/workflows/cron.yml index 6fa546d..ab1f564 100644 --- a/.github/workflows/cron.yml +++ b/.github/workflows/cron.yml @@ -34,3 +34,4 @@ jobs: git add src/headers-order.json git diff-index --quiet HEAD || git commit -m 'build(update): headers order' --no-verify git push origin HEAD + curl -fsS -m 10 --retry 5 -o /dev/null https://hc-ping.com/8ddbde82-63f2-420c-8e48-373c0800df74 From cc01773cdc75b96d0bba9230f6336b2797acd695 Mon Sep 17 00:00:00 2001 From: Kiko Beats Date: Wed, 28 Oct 2026 18:17:03 +0100 Subject: [PATCH 3/3] fix(postinstall): warn instead of failing the install A failed fetch (offline install, upstream down) used to exit 1 and break `npm install https-tls`. It now warns and keeps the bundled file. The cron runs it with --strict so a broken fetch still fails the job and skips the healthcheck ping instead of passing silently. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/cron.yml | 2 +- scripts/postinstall.js | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cron.yml b/.github/workflows/cron.yml index ab1f564..956a6a2 100644 --- a/.github/workflows/cron.yml +++ b/.github/workflows/cron.yml @@ -29,7 +29,7 @@ jobs: run: | git config --global user.email ${{ secrets.GIT_EMAIL }} git config --global user.name ${{ secrets.GIT_USERNAME }} - npm run postinstall + node scripts/postinstall.js --strict npm test git add src/headers-order.json git diff-index --quiet HEAD || git commit -m 'build(update): headers order' --no-verify diff --git a/scripts/postinstall.js b/scripts/postinstall.js index 4ec3ad3..ea79d1f 100644 --- a/scripts/postinstall.js +++ b/scripts/postinstall.js @@ -5,6 +5,8 @@ const { writeFile } = require('fs/promises') const URL = 'https://raw.githack.com/apify/fingerprint-suite/master/packages/header-generator/src/data_files/headers-order.json' +const isStrict = process.argv.includes('--strict') + fetch(URL) .then(res => { if (!res.ok) throw new Error(`HTTP error! status: ${res.status}`) @@ -13,4 +15,12 @@ fetch(URL) .then(headersOrder => writeFile('src/headers-order.json', JSON.stringify(headersOrder, null, 2)) ) - .catch(error => console.error(error) || process.exit(1)) + .catch(error => { + if (isStrict) { + console.error(error) + process.exit(1) + } + console.warn( + `https-tls: couldn't update headers order, using the bundled one (${error.message})` + ) + })