This repository has been archived by the owner on Feb 26, 2024. It is now read-only.
Update datagouv #42
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 datagouv | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: "0 0 * * 1" # every monday | |
concurrency: | |
cancel-in-progress: true | |
group: update-datagouv | |
jobs: | |
update-datagouv: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
with: | |
token: ${{ secrets.SOCIALGROOVYBOT_BOTO_PAT }} | |
- name: Download data | |
id: download | |
continue-on-error: true | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y curl git | |
# download https://www.data.gouv.fr/fr/datasets/liste-des-conventions-collectives-par-entreprise-siret/ | |
echo "Download from data.gouv" | |
curl -L https://www.data.gouv.fr/fr/datasets/r/bfc3a658-c054-4ecc-ba4b-22f3f5789dc7 -o "./WEEZ.csv" | |
# ensure we have an entry for "renault SAS" | |
echo "Check validity" | |
cat ./WEEZ.csv | grep 78012998704037 | |
# check if its a new file | |
gunzip ./data/WEEZ.csv.gz | |
if [[ $(diff ./WEEZ.csv ./data/WEEZ.csv) ]]; then | |
echo "File changed" | |
gzip -v ./WEEZ.csv | |
gzip -t ./WEEZ.csv.gz | |
echo "move" | |
mv ./WEEZ.csv.gz ./data/WEEZ.csv.gz | |
exit 0 | |
else | |
echo "File not changed" | |
rm ./WEEZ.csv | |
exit 1 | |
fi; | |
- name: Commit changes | |
uses: stefanzweifel/git-auto-commit-action@v4 | |
if: steps.download.outcome == 'success' | |
with: | |
file_pattern: "data/*" | |
commit_message: "fix: Update datagouv data" | |
commit_author: "GitHub bot <[email protected]>" |