add rebase before commiting logs #11
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Update universes | |
on: | |
schedule: | |
- cron: '27 7 * * *' | |
# FIXME: remove | |
push: | |
branches: | |
- feat/ci | |
jobs: | |
run-demo-update: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.x' | |
- name: Install dependencies | |
run: | | |
pip install --upgrade pip | |
pip install -r requirements.txt | |
- name: Update demo universe | |
env: | |
DATAGOUV_URL: https://demo.data.gouv.fr | |
DATAGOUV_API_KEY: ${{ secrets.DATAGOUV_API_KEY_DEMO }} | |
run: | | |
python -u feed-universe.py universe-demo.yaml --dry-run 2>&1 | tee logs/run_log_demo.txt | |
- name: Commit Run Logs | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Action" | |
git pull --rebase origin ${{ github.ref_name }} | |
git add logs/run_log_demo.txt | |
git commit -m "Update daily run log for demo" | |
- name: Push changes | |
run: | | |
git push | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run-prod-update: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.x' | |
- name: Install dependencies | |
run: | | |
pip install --upgrade pip | |
pip install -r requirements.txt | |
- name: Update prod universe | |
env: | |
DATAGOUV_URL: https://www.data.gouv.fr | |
DATAGOUV_API_KEY: ${{ secrets.DATAGOUV_API_KEY_PROD }} | |
run: | | |
python -u feed-universe.py universe-prod.yaml --dry-run 2>&1 | tee logs/run_log_prod.txt | |
- name: Commit Run Logs | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Action" | |
git pull --rebase origin ${{ github.ref_name }} | |
git add logs/run_log_prod.txt | |
git commit -m "Update daily run log for prod" | |
- name: Push changes | |
run: | | |
git push | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |