Skip to content

Automatically sync Infix #34

Automatically sync Infix

Automatically sync Infix #34

Workflow file for this run

name: Automatically sync Infix
on:
workflow_dispatch:
schedule:
- cron: '0 2 * * *'
permissions:
contents: write
jobs:
check_changes:
runs-on: [ self-hosted, latest ]
if: ${{ vars.SYNC_INFIX }}
outputs:
has_changes: ${{ steps.check_changes.outputs.has_changes }}
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.COMMIT_TOKEN }}
fetch-depth: 0
submodules: true
- name: Check for updates and commit if needed
id: check_changes
run: |
git config --global user.name 'Wires bot'
git config --global user.email 'noreply@wires.se'
CHANGES=0
if [ -z "$(git branch | grep latest)" ]; then
if [ -n "$(git branch -r | grep latest)" ]; then
git checkout latest
else
git checkout -b latest
fi
fi
git checkout latest
if [[ -n "$(git diff --exit-code origin/main)" ]]; then
echo "New commits exist on main"
git merge origin/main
CHANGES=1
fi
cd infix
git clean -ffdx
git checkout main
git pull origin main
cd ..
if [[ -n "$(git diff --exit-code infix)" ]]; then
git add infix
git commit infix -m "Step up infix"
CHANGES=1
fi
make defconfigs-generate
if [[ -n "$(git diff --exit-code configs)" ]]; then
git add configs
git commit configs/ -m "Update defconfigs"
CHANGES=1
fi
echo "has_changes=$CHANGES" >> $GITHUB_OUTPUT
if [ $CHANGES -eq 1 ]; then
git push origin latest
fi