| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- # Copyright (c) 2008-2022 the Urho3D project
- # License: MIT
- ---
- name: Style
- on:
- workflow_dispatch:
- schedule: [ cron: '0 0 * * *' ]
- jobs:
- Style:
- name: Style
- runs-on: ubuntu-latest
- if: github.repository == 'urho3d/Urho3D'
- steps:
- - name: Remove end-line spaces
- shell: bash {0} # Allow catching errors
- run: |
- #set -x # Echo commands
- git config --global user.email "urho3d[bot]@users.noreply.github.com"
- git config --global user.name "Urho3D[bot]"
- # Someone can push to the repo at the same time, so try several times
- for (( i = 0; i < 4; ++i ))
- do
- git clone https://github.com/${{ github.repository }} engine_repo
- cd engine_repo
- find ./bin -type f \( -name '*.glsl' -or -name '*.hlsl' -or -name '*.xml' \) -exec perl -i -pe 's/[ \t]+(\r?\n)/$1/g' {} +
- find ./cmake -type f -exec perl -i -pe 's/[ \t]+(\r?\n)/$1/g' {} +
- find ./Source/Urho3D -type f -exec perl -i -pe 's/[ \t]+(\r?\n)/$1/g' {} +
- git add -A
- git diff-index --quiet HEAD || git commit -m "Remove end-line spaces" # Create the commit if there are changes
- git push https://oauth2:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
- EXIT_CODE=$? # Save exit code of the previous command
- cd ..
- if (( $EXIT_CODE == 0 ))
- then
- break
- else
- echo "========== One more try =========="
- rm -rf engine_repo
- sleep 20
- fi
- done
- ...
- # vi: set ts=2 sw=2 expandtab:
|