Skip to content

Merge pull request #4 from rotators/dependabot/github_actions/actions… #49

Merge pull request #4 from rotators/dependabot/github_actions/actions…

Merge pull request #4 from rotators/dependabot/github_actions/actions… #49

Workflow file for this run

name: ReDefine
on:
schedule:
- cron: 0 3 1 * *
push:
paths:
- '.github/workflows/ReDefine.yml'
- 'ReDefineOne.sh'
- 'ReDefineOne.GHA.sh'
- 'ReDefineZip.sh'
- 'ReDefine.cfg'
- 'Tools/*'
- 'UpdateTools.sh'
- '*/*.zip'
workflow_dispatch:
defaults:
run:
shell: bash
jobs:
Run:
if: github.actor != 'antalaskaya'
runs-on: ubuntu-latest
env:
GHA_COMMIT: .git/gha.commit
steps:
- name: Clone
uses: actions/checkout@v6
with:
token: ${{ secrets.ANTALASKAYA_TOKEN }}
- name: Install
run: sudo apt update && sudo apt install -y dos2unix && hash -r
- name: Tools
run: ./UpdateTools.sh
- name: Games
run: find Games -path '*.zip' -exec ./ReDefineOne.GHA.sh "{}" \;
- name: Mods
run: find Mods -path '*.zip' -exec ./ReDefineOne.GHA.sh "{}" \;
- name: Cleanup
run: |
:
for root in Games Mods; do
if [[ ! -d "$root" ]]; then
continue
fi
find $root/ -mindepth 1 -maxdepth 1 -type d | sort | while read dir; do
if [[ ! -f "$dir.zip" ]]; then
echo "- Deleted $dir/" >> $GHA_COMMIT
git rm -r $dir/
fi
done
done
- name: Validation
run: |
:
if [[ -f "$GHA_COMMIT" ]]; then
sed -i '1s!^!ReDefine run\n!' $GHA_COMMIT
dos2unix $GHA_COMMIT
cat $GHA_COMMIT
echo GHA_PUSH=true >> $GITHUB_ENV
fi
- name: Push
if: env.GHA_PUSH == 'true'
run: |
:
echo ::group::git commit
sed -i '/^#/d' $GHA_COMMIT
git config --global user.name "${{ secrets.ANTALASKAYA_NAME }}"
git config --global user.email "${{ secrets.ANTALASKAYA_EMAIL }}"
git commit --file="$GHA_COMMIT" 2>&1
rm -f $GHA_COMMIT
echo ::endgroup::
#echo ::group::git log
#git log -p -n 1 2>&1
#echo ::endgroup::
echo ::group::git push
git push 2>&1
echo ::endgroup::
echo "Repository size: $(( $(curl --silent https://api.github.com/repos/${{ github.repository }} | jq -r '.size') / 1024 ))MB"