.github/workflows/tempo.yml #246
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
on: | |
schedule: | |
- cron: "30 8 * * *" | |
workflow_dispatch: | |
jobs: | |
get-tempo: | |
runs-on: self-hosted | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v4 | |
- name: GET EDF historicTEMPOStore 09-2023 - 09-2024 | |
run: | | |
curl 'https://particulier.edf.fr/services/rest/referentiel/historicTEMPOStore?dateBegin=2023&dateEnd=2024' -o tempo_2024.json | |
- name: Merge tempo_*.json and tempo.json | |
run: | | |
jq -s 'map(.dates |= map(select(.couleur != "NON_DEFINI"))) | unique_by(.dates[].date) | { "dates": map(.dates[])}' tempo_2024.json tempo.json > tempo_new.json | |
jq ' .dates |= unique_by(.date) ' tempo_new.json > tempo_dedup.json | |
- name: Replace old tempo.json file | |
run: mv tempo_dedup.json tempo.json | |
- name: Cleanup | |
run: rm tempo_*.json | |
- name: Commit file | |
uses: stefanzweifel/git-auto-commit-action@v5 | |
with: | |
commit_message: Update tempo.json | |
branch: main | |
file_pattern: "tempo.json" |