Skip to content

version-check

version-check #34

Workflow file for this run

name: version-check
on:
schedule:
- cron: "0 0 * * 1" # Weekly on Monday
workflow_dispatch:
permissions:
contents: read
issues: write
jobs:
check:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v6
- name: Check for updates
id: check
run: |
set -e # Exit on error
# Fetch API and extract latest timestamp
API_JSON=$(curl -sf https://puppetdoc.anytype.io/api/v1/prod-any-sync-compatible-versions/)
LATEST_TIMESTAMP=$(echo "$API_JSON" | jq -r 'keys | max')
# Extract current timestamp from go.mod comment
CURRENT_TIMESTAMP=$(grep 'Current timestamp:' go.mod | head -1 | sed 's/.*"\([0-9]*\)".*/\1/')
# Simple comparison: different timestamp = update available
if [ "$LATEST_TIMESTAMP" = "$CURRENT_TIMESTAMP" ]; then
echo "✅ Already up to date (timestamp: $CURRENT_TIMESTAMP)"
exit 0
fi
echo "📦 Update available: $CURRENT_TIMESTAMP → $LATEST_TIMESTAMP"
echo "needs_update=true" >> $GITHUB_ENV
echo "latest_ts=$LATEST_TIMESTAMP" >> $GITHUB_ENV
echo "current_ts=$CURRENT_TIMESTAMP" >> $GITHUB_ENV
# Store versions for issue body
echo "$API_JSON" | jq -r ".\"$LATEST_TIMESTAMP\"" > new_versions.json
- name: Create issue
if: env.needs_update == 'true'
env:
GH_TOKEN: ${{ github.token }}
run: |
# Check if issue already exists
TITLE="Update to Anytype release ${{ env.latest_ts }}"
if gh issue list --search "$TITLE" --state open | grep -q .; then
echo "Issue already exists"
exit 0
fi
# Create issue body
cat > issue.md << 'EOF'
New Anytype release available.
**Current:** ${{ env.current_ts }}
**Latest:** ${{ env.latest_ts }}
**Source:** https://puppetdoc.anytype.io/api/v1/prod-any-sync-compatible-versions/
EOF
# Add versions as simple list
jq -r 'to_entries | .[] | "- `\(.key)`: v\(.value)"' new_versions.json >> issue.md
# Add update process
cat >> issue.md << 'EOF'
## Update
Update `go.mod` with the versions above.
Also update the timestamp comment:
```
// Current timestamp: "${{ env.current_ts }}" → "${{ env.latest_ts }}"
```
`go mod tidy` may also update `github.com/anyproto/any-sync` automatically.
Verify:
```
go mod tidy
go mod verify
golangci-lint run --fix ./...
go test -race -shuffle=on -vet=all -failfast ./...
go build -o any-sync-bundle .
./any-sync-bundle --version
./any-sync-bundle --help
nix build .#default
nix flake check
```
Optional smoke test:
```bash
go test -tags=integration ./integration/...
```
---
*Automated by version-check workflow*
EOF
gh issue create --title "$TITLE" --body-file issue.md --label dependencies --assignee grishy