Skip to content

Commit

Permalink
factorize take 2
Browse files Browse the repository at this point in the history
  • Loading branch information
abulte committed Nov 13, 2024
1 parent 5dfe749 commit 7afcc91
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 60 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/update-universe/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Update universe (base)

inputs:
env-name:
description: Name of the environment (demo or prod)
required: true
type: string
env-config-file:
description: Name of the universe configuration file
required: true
type: string
datagouv-url:
description: URL of the data.gouv.fr instance
required: true
type: string
api-key-secret:
description: Secret containing the API key
required: true
type: string

runs:
using: "composite"
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 universe
env:
DATAGOUV_URL: ${{ inputs.datagouv-url }}
DATAGOUV_API_KEY: ${{ secrets[inputs.api-key-secret] }}
run: |
python -u feed-universe.py ${{ inputs.env-config-file }} --dry-run 2>&1 | tee logs/run_log_${{ inputs.env-name }}.txt
- name: Commit Run Logs
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add logs/run_log_${{ inputs.env-name }}.txt
git commit -m "Update daily run log for ${{ inputs.env-name }}"
- name: Push changes
run: |
git push
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
58 changes: 0 additions & 58 deletions .github/workflows/update-universes-base.yml

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/update-universes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ jobs:
uses: actions/checkout@v4

- name: Update demo universe
uses: ./.github/workflows/update-universes-base.yml
uses: ./.github/actions/update-universe
with:
env-name: demo
env-config-file: universe-demo.yaml
datagouv-url: https://demo.data.gouv.fr
api-key-secret: DATAGOUV_API_KEY_DEMO

- name: Update prod universe
uses: ./.github/workflows/update-universes-base.yml
uses: ./.github/actions/update-universe
with:
env-name: prod
env-config-file: universe-prod.yaml
Expand Down

0 comments on commit 7afcc91

Please sign in to comment.