Skip to content

Commit 3429d5d

Browse files
authored
Create main.yml
1 parent f90c54c commit 3429d5d

File tree

1 file changed

+70
-0
lines changed

1 file changed

+70
-0
lines changed

.github/workflows/main.yml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: Monitor GitHub Followers
2+
on:
3+
schedule:
4+
- cron: '0 */6 * * *' # Every 6 hours
5+
workflow_dispatch: # Manual trigger
6+
push:
7+
branches: [ main ]
8+
9+
permissions:
10+
contents: write
11+
pages: write
12+
id-token: write
13+
14+
concurrency:
15+
group: "pages"
16+
cancel-in-progress: false
17+
18+
jobs:
19+
monitor-followers:
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: Checkout repository
23+
uses: actions/checkout@v4
24+
with:
25+
fetch-depth: 0
26+
27+
- name: Setup Node.js
28+
uses: actions/setup-node@v4
29+
with:
30+
node-version: '18'
31+
32+
- name: Monitor followers and update data
33+
env:
34+
TOKEN: ${{ secrets.TOKEN }}
35+
GITHUB_USERNAME: ${{ github.repository_owner }}
36+
run: |
37+
node scripts/monitor.js
38+
39+
- name: Commit and push changes
40+
run: |
41+
git config --local user.email "action@github.com"
42+
git config --local user.name "GitHub Action"
43+
git add data/
44+
if git diff --staged --quiet; then
45+
echo "No changes to commit"
46+
else
47+
git commit -m "Update follower data - $(date)"
48+
git push
49+
fi
50+
51+
deploy:
52+
needs: monitor-followers
53+
runs-on: ubuntu-latest
54+
steps:
55+
- name: Checkout
56+
uses: actions/checkout@v4
57+
with:
58+
ref: main
59+
60+
- name: Setup Pages
61+
uses: actions/configure-pages@v4
62+
63+
- name: Upload artifact
64+
uses: actions/upload-pages-artifact@v3
65+
with:
66+
path: './dashboard'
67+
68+
- name: Deploy to GitHub Pages
69+
id: deployment
70+
uses: actions/deploy-pages@v4

0 commit comments

Comments
 (0)