Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add form download script #932

Merged
merged 24 commits into from
Jan 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions .github/workflows/form-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Quality Assurance

on:
schedule:
- cron: '0 * * * *' # This cron expression runs the workflow every hour

env:
CURRENT_FORM_VERSION: "DPFOBv24"

jobs:
download:
name: Download Form File
runs-on: ubuntu-latest
if: github.ref_name == 'master'

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 form.zip
rm -rf ./public/form
mkdir ./public/form
mv ./form.* ./public/form
FORM_FOLDER=$(find ./public/form -maxdepth 1 -type d ! -path ./public/form | head -n 1 | sed 's|./||')
mv $FORM_FOLDER/* ./public/form
rm -rf $FORM_FOLDER
ls -ls ./public/form
- 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


1 change: 1 addition & 0 deletions public/form.zip.md5
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1f98b8f3f3c8f8927eca945d59dcc1c6
Loading