Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions .github/workflows/cron.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
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 }}
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
git push origin HEAD
curl -fsS -m 10 --retry 5 -o /dev/null https://hc-ping.com/8ddbde82-63f2-420c-8e48-373c0800df74
12 changes: 11 additions & 1 deletion scripts/postinstall.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}`)
Expand All @@ -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})`
)
})
Loading