name: Check pi version drift on: schedule: - cron: "0 6 * * *" # Daily at 6am workflow_dispatch: jobs: check-pi: runs-on: nixos steps: - name: Checkout laptop-config uses: actions/checkout@v4 - name: Get latest pi-mono tag id: tag run: | # Forgejo mirror of badlogic/pi-mono LATEST=$(git ls-remote --tags https://os.scoble.me/forgejo/sscoble/pi-mono.git \ | grep -v '\^{}' \ | awk -F/ '{print $NF}' \ | grep -E '^v?[0-9]' \ | sort -V | tail -1) echo "latest=$LATEST" >> $GITHUB_OUTPUT echo "Latest pi-mono tag: $LATEST" - name: Get current version in flake id: current run: | CURRENT=$(grep -E 'version = "' flake.nix | head -1 | sed 's/.*version = "\([^"]*\)".*/\1/') echo "current=$CURRENT" >> $GITHUB_OUTPUT echo "Current flake version: $CURRENT" - name: Open issue on drift if: steps.tag.outputs.latest != '' && steps.tag.outputs.latest != steps.current.outputs.current run: | LATEST="${{ steps.tag.outputs.latest }}" CURRENT="${{ steps.current.outputs.current }}" echo "DRIFT: pi-mono $LATEST vs flake $CURRENT" # Create issue via API if token is available if [ -n "$FORGEJO_TOKEN" ]; then curl -s -X POST "https://os.scoble.me/forgejo/api/v1/repos/sscoble/laptop-config/issues" \ -H "Authorization: token $FORGEJO_TOKEN" \ -H "Content-Type: application/json" \ -d "{ \"title\": \"pi: upstream $LATEST available (flake has $CURRENT)\", \"body\": \"The pi-mono mirror has tag \`$LATEST\`. The flake currently targets \`$CURRENT\`.\\n\\nAction: update \`flake.nix\` version string and rebuild.\", \"labels\": [\"improvement\"] }" fi