-
Notifications
You must be signed in to change notification settings - Fork 2
43 lines (35 loc) · 1.05 KB
/
update-traffic-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
name: Update Traffic Data
on:
schedule:
- cron: '0 */12 * * *'
jobs:
update-traffic:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Pull latest changes
run: git pull origin main
- name: Install dependencies
run: npm install
- name: Update Traffic Data
env:
GITHUB_TOKEN: ${{ secrets.WORKFLOW_GITHUB_TOKEN }}
GITHUB_USER: toFrankie
GITHUB_REPO: blog
run: node scripts/update-traffic-data.js
- name: Commit changes
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com'
git add docs/traffic
if git diff-index --quiet HEAD; then
echo "No changes detected."
else
git commit -m "docs: update traffic data"
git push
fi