Skip to content

Commit 136c639

Browse files
authored
[add][m] Early update Github Actions (#14)
* [add][m] Early update Github Actions * [fix][s] quarterly cron job * [fix][s] Changing the add path
1 parent 10de5a5 commit 136c639

File tree

1 file changed

+61
-0
lines changed

1 file changed

+61
-0
lines changed

.github/workflows/actions.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Update population dataset
2+
3+
on:
4+
# Schedule to run on the 1st January each year
5+
schedule:
6+
- cron: '0 0 1 1,4,7,10 *'
7+
8+
push:
9+
branches:
10+
- main
11+
12+
pull_request:
13+
branches:
14+
- main
15+
16+
workflow_dispatch:
17+
18+
jobs:
19+
build:
20+
runs-on: ubuntu-latest
21+
22+
if: github.ref == 'refs/heads/main'
23+
24+
steps:
25+
- name: Check out repository
26+
uses: actions/checkout@v3
27+
28+
- name: Set up Python 3.12
29+
uses: actions/setup-python@v4
30+
with:
31+
python-version: '3.12'
32+
33+
- name: Install dependencies
34+
run: |
35+
python -m venv venv
36+
source venv/bin/activate
37+
python -m pip install --upgrade pip
38+
pip install -r requirements.txt
39+
40+
- name: Run shell script
41+
run: |
42+
source venv/bin/activate
43+
python scripts/process.py
44+
45+
- name: Configure Git
46+
run: |
47+
git config --global user.email "${{ env.CI_COMMIT_EMAIL }}"
48+
git config --global user.name "${{ env.CI_COMMIT_NAME }}"
49+
env:
50+
CI_COMMIT_NAME: "Automated commit"
51+
CI_COMMIT_EMAIL: "[email protected]"
52+
53+
- name: Commit and Push changes
54+
run: |
55+
git diff --quiet && echo "No changes to commit" || (
56+
git add data &&
57+
git commit -m "${{ env.CI_COMMIT_MESSAGE }}" &&
58+
git push origin main
59+
)
60+
env:
61+
CI_COMMIT_MESSAGE: "Automated commit"

0 commit comments

Comments
 (0)