Skip to content

Update ViewMenu.dart #211

Update ViewMenu.dart

Update ViewMenu.dart #211

name: Validazione File Domande
on:
push:
branches:
- main
defaults:
run:
shell: bash
jobs:
Validazione-File-Domande:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v2
with:
token: ${{ secrets.GH_TOKEN }}
- run: cd ${{ github.workspace }}
- name: Controllo Codifica File
run: |
file_domande="Domande.txt"
codifica="UTF-8"
# Check Encoding
charset=$(file -i "$file_domande" | cut -f 2 -d ";" | cut -f 2 -d "=")
if [[ "${charset^^}" = "$codifica" ]]
then
echo "✔️ DEUBG: Codifica OK ($charset)"
cp "$file_domande" "app-desktop/Domande.txt"
cp "$file_domande" "app-mobile/flutter_application/assets/domande.txt"
# Check if there are changes
if [[ -n $(git status -s) ]]
then
# Commit & Push changes
git add -f "app-desktop/Domande.txt"
git add -f "app-mobile/flutter_application/assets/domande.txt"
git config --global user.email "righi.michele98@gmail.com"
git config --global user.name "mikyll"
git commit -m "Update file domande"
git push https://${{ secrets.GH_TOKEN }}@github.com/${{ github.repository }}
echo "✔️ File domande aggiornati!"
else
echo "Nessuna modifica necessaria."
fi
else
echo "❌ ERRORE: Codifica file \"$file_domande\" errata ($charset)"
exit 1
fi