-
Notifications
You must be signed in to change notification settings - Fork 1
53 lines (42 loc) · 1.39 KB
/
fetch_coin_data.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
41
42
43
44
45
46
47
48
49
50
51
52
53
name: Fetch Coin Data
on:
schedule:
- cron: '0 */12 * * *'
workflow_dispatch: # Allows manual run from the GitHub Actions UI
push:
branches:
- main # Runs on pushes to the main branch
jobs:
fetch_coin_data:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '16'
- name: Install dependencies
run: npm install axios
- name: Run Coin Data Fetch Script
run: node coins.cjs
- name: Reset Progress File
if: success()
run: |
echo '{"lastProcessedIndex":-1}' > progress.json
- name: Save JSON to Artifact
if: success()
uses: actions/upload-artifact@v4
with:
name: customCoinData
path: customCoinData.json # The output JSON file
retention-days: 5 # Retain data for a set number of days (optional)
- name: Commit and Push Progress
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config --global user.name 'genfuture'
git config --global user.email 'g.prem2349@gmail.com'
git add customCoinData.json progress.json
git commit -m "Update Coin Data"
git push https://x-access-token:${GITHUB_TOKEN}@github.com/genfuture/cryptocurrency-scraper.git main