-
Notifications
You must be signed in to change notification settings - Fork 3
51 lines (46 loc) · 1.63 KB
/
check_file_domande.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
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