Skip to content

Commit 3235b23

Browse files
authored
Merge pull request #5 from datasets/ga-actions
[add][m] github actions
2 parents 5c20021 + 4108692 commit 3235b23

File tree

1 file changed

+65
-0
lines changed

1 file changed

+65
-0
lines changed

.github/workflows/actions.yml

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

0 commit comments

Comments
 (0)