-
Notifications
You must be signed in to change notification settings - Fork 0
40 lines (34 loc) · 1.23 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
name: Fetch and Save Data
on:
schedule:
- cron: '0 0 * * 1' # Run every Monday at midnight
push:
branches:
- main
jobs:
fetch-and-save-data:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: 14
- name: Install Dependencies
run: npm install node-fetch
- name: Fetch and Save Data
run: |
node -e "import fetch from 'node-fetch'; \
import fs from 'fs'; \
fetch('https://vdnh.ru/local/templates/v3_new_header/js/places-s1.js') \
.then(response => response.text()) \
.then(data => { \
const jsonData = data.replace(/^var places = |;$/g, ''); \
const backupData = JSON.stringify(jsonData, null, 2); \
fs.writeFileSync('backup.json', backupData); \
}) \
.catch(error => { \
console.error('Error fetching data:', error); \
process.exit(1); \
})" --loader ts-node/esm