Skip to content

Commit 778c51f

Browse files
committed
build(projects): github workflow to update projects data every day
1 parent 75faf2e commit 778c51f

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

.github/workflows/update_data.yaml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Update Projects Data
2+
3+
on:
4+
schedule:
5+
- cron: "0 0 * * *"
6+
7+
jobs:
8+
main:
9+
name: Generate and push latest data
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout Repository
14+
uses: actions/checkout@v4
15+
16+
- name: Configure python
17+
uses: actions/setup-python@v5
18+
with:
19+
python-version: '3.13'
20+
21+
- name: Run Python Script
22+
run: python get_repos.py
23+
24+
- name: Configure Git
25+
run: |
26+
git config user.name "github-actions[bot]"
27+
git config user.email "github-actions[bot]@users.noreply.github.com"
28+
29+
- name: Commit and Push changes
30+
env:
31+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
32+
run: |
33+
if [ -n "$(git status --porcelain src/data/)" ]; then
34+
echo "[+] src/data has been updated"
35+
git add src/data/
36+
git commit -m "chore(data): update projects data"
37+
git push https://x-access-token:${GITHUB_TOKEN}@github.com/${{ github.repository }} HEAD:${{ github.ref }}
38+
else
39+
echo "[-] No change in src/data/"
40+
fi
41+

0 commit comments

Comments
 (0)