Update dev sheet #7629
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 dev sheet | |
on: | |
schedule: | |
- cron: "0 0 * * *" # Run once a day | |
workflow_dispatch: | |
jobs: | |
update-dev-sheet: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Make a copy of old CSV files so they can be compared | |
run: | | |
mkdir -p csv/ | |
cp -R csv/ csv_old/ | |
git rm -r csv/* | |
- name: Install XLSX to CSV converter | |
run: | | |
sudo apt-get update | |
sudo apt-get install --yes gnumeric | |
- name: Download dev spreadsheet from Google Sheets | |
run: wget --no-check-certificate --output-document=dev_sheet.xlsx "https://docs.google.com/spreadsheets/d/${{ secrets.DEV_SHEET_ID }}/export?format=xlsx" | |
- name: Convert XLSX spreadsheet to CSVs | |
run: | | |
mkdir csv/ | |
ssconvert --export-type=Gnumeric_stf:stf_csv dev_sheet.xlsx csv/sheet-%n.csv --export-file-per-sheet | |
- name: Configure git user | |
run: | | |
git config --local user.email "$(git log --format='%ae' HEAD^!)" | |
git config --local user.name "$(git log --format='%an' HEAD^!)" | |
- name: Commit and push dev spreadsheet if there are changes | |
run: | | |
# Only commit if there are changes | |
if diff -r csv/ csv_old/; then | |
echo "No changes detected" | |
else | |
git add dev_sheet.xlsx | |
git add csv | |
git commit -am "Update dev sheet" | |
git push origin main | |
fi |