name: Format sites on: push: branches: - master jobs: format-sites: runs-on: codeberg-tiny steps: - name: Checkout uses: actions/checkout@v4 with: fetch-depth: 0 - name: Install yq run: | sudo wget -qO /usr/local/bin/yq https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 sudo chmod +x /usr/local/bin/yq - name: Skip if last commit is from the bot run: | if git log -1 --pretty=format:'%an' | grep -q "Formatting Bot"; then echo "Last commit by bot, skipping" exit 0 fi - name: Format and push run: | git config user.email "bot@1mb.club" git config user.name "Formatting Bot" yq --inplace 'sort_by(.domain)' _data/sites.yml sed -i '1!s/- domain:/\n- domain:/g' _data/sites.yml git diff --quiet || (git commit -am "Fix formatting" && git push)