-
Notifications
You must be signed in to change notification settings - Fork 13
61 lines (55 loc) · 2.02 KB
/
form-check.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
52
53
54
55
56
57
58
59
name: Quality Assurance
on:
pull_request:
branches: [ master ]
schedule:
- cron: '0 0 * * *' # This cron expression runs the workflow every day at midnight UTC
env:
CURRENT_FORM_VERSION: "DPFOBv23"
jobs:
download:
name: Download Form File
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Download config file
run: wget https://edane.financnasprava.sk/java/prod/eform/config.xml -O config.xml
- name: Filter only for Danove Priznanie Files
run: |
grep -i "DPFO" config.xml | grep "ElektronickyFormular" > dp.out
cat dp.out
ZIP_URL=$(grep -i $CURRENT_FORM_VERSION dp.out | sed -n 's/.*Url="\([^"]*\)".*/\1/p')
echo $ZIP_URL
wget $ZIP_URL -O form.zip
- name: Check if new version is available
id: check-step
run: |
md5sum form.zip
md5sum form.zip > ./public/form.zip.md5
if git diff --exit-code ./public/form.zip.md5; then
echo "skipnext=true" >> $GITHUB_OUTPUT
else
echo "skipnext=false" >> $GITHUB_OUTPUT
fi
- name: Unzip form files
if : ( steps.check-step.outputs.skipnext != 'true' )
run: |
echo "will only run if skipnext is not true"
unzip form.zip -d ./
rm -rf ./public/form
mkdir ./public/form
mv ./form.* ./public/form
ls -ls ./public/form
- name: Commit changes
if : ( steps.check-step.outputs.skipnext != 'true' )
run: |
- name: Create new branch and commit changes
if: steps.check-step.outputs.skipnext != 'true'
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git checkout -b update-form-$(date +%Y%m%d%H%M%S)
git add ./public/form.zip.md5 ./public/form
git commit -m "Update form files"
git push origin HEAD