Check Protobuf Updates #37
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Check Protobuf Updates | |
| on: | |
| schedule: | |
| # Run every Monday at 9am UTC | |
| - cron: "0 9 * * 1" | |
| workflow_dispatch: # Allow manual trigger | |
| jobs: | |
| check-protobuf-updates: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| issues: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - name: Get current protobuf version | |
| id: current | |
| run: | | |
| if [ -f "protos/VERSION" ]; then | |
| VERSION=$(cat protos/VERSION | tr -d '\n') | |
| else | |
| VERSION="unknown" | |
| fi | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| echo "Current protobuf version: $VERSION" | |
| - name: Get latest Meshtastic protobuf version | |
| id: latest | |
| run: | | |
| LATEST=$(curl -s https://api.github.com/repos/meshtastic/protobufs/releases/latest | jq -r .tag_name) | |
| echo "version=$LATEST" >> $GITHUB_OUTPUT | |
| echo "Latest protobuf version: $LATEST" | |
| - name: Compare versions | |
| id: compare | |
| env: | |
| CURRENT_VERSION: ${{ steps.current.outputs.version }} | |
| LATEST_VERSION: ${{ steps.latest.outputs.version }} | |
| run: | | |
| CURRENT="$CURRENT_VERSION" | |
| LATEST="$LATEST_VERSION" | |
| if [ "$CURRENT" = "$LATEST" ]; then | |
| echo "needs_update=false" >> $GITHUB_OUTPUT | |
| echo "Protobufs are up to date ($CURRENT)" | |
| else | |
| echo "needs_update=true" >> $GITHUB_OUTPUT | |
| echo "Protobuf update available: $CURRENT → $LATEST" | |
| fi | |
| - name: Check for existing issue | |
| id: existing | |
| if: steps.compare.outputs.needs_update == 'true' | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| LATEST_VERSION: ${{ steps.latest.outputs.version }} | |
| run: | | |
| LATEST="$LATEST_VERSION" | |
| EXISTING=$(gh issue list --label "protobuf-update" --state open --json number,title --jq ".[] | select(.title | contains(\"$LATEST\")) | .number") | |
| if [ -n "$EXISTING" ]; then | |
| echo "exists=true" >> $GITHUB_OUTPUT | |
| echo "Issue #$EXISTING already exists for version $LATEST" | |
| else | |
| echo "exists=false" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Create issue for update | |
| if: steps.compare.outputs.needs_update == 'true' && steps.existing.outputs.exists == 'false' | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| CURRENT_VERSION: ${{ steps.current.outputs.version }} | |
| LATEST_VERSION: ${{ steps.latest.outputs.version }} | |
| run: | | |
| # Create label if it doesn't exist | |
| gh label create "protobuf-update" --description "Protobuf version update available" --color "0366d6" 2>/dev/null || true | |
| cat << 'EOF' > /tmp/issue_body.md | |
| ## Protobuf Update Available | |
| A new version of Meshtastic protobufs has been released. | |
| | | Version | | |
| |---|---| | |
| | **Current** | `CURRENT_PLACEHOLDER` | | |
| | **Latest** | `LATEST_PLACEHOLDER` | | |
| ### Update Instructions | |
| Run the following commands in order: | |
| ```bash | |
| # 1. Regenerate protobufs from upstream. | |
| ./scripts/generate_protos.sh update LATEST_PLACEHOLDER | |
| # 2. Refresh the upstream hardware catalog (used by device_hardware_catalog.dart | |
| # for hwModel → architecture mapping in the firmware update flow). | |
| ./scripts/fetch_device_hardware.sh | |
| # 3. Run the parity test — this is the signal for whether the supplement | |
| # in lib/services/firmware/device_hardware_catalog.dart needs editing. | |
| flutter test test/services/firmware/hardware_architecture_test.dart | |
| ``` | |
| If step 1 prints `✅ Protobuf generation complete!` but `git status lib/generated/` shows nothing changed, run `./scripts/generate_protos.sh generate` once more — the noisy pub-cache output can mask a silently-skipped codegen step. | |
| ### Release Notes | |
| View the release notes at: | |
| https://github.com/meshtastic/protobufs/releases/tag/LATEST_PLACEHOLDER | |
| ### Checklist | |
| - [ ] Run `./scripts/generate_protos.sh update LATEST_PLACEHOLDER` — verify `protos/VERSION` and `lib/generated/meshtastic/` changed | |
| - [ ] Run `./scripts/fetch_device_hardware.sh` — review any reported architecture mismatches or redundant supplement entries | |
| - [ ] Run `flutter test test/services/firmware/hardware_architecture_test.dart` — if a new `HardwareModel` lacks coverage, add it to `_supplement` in `lib/services/firmware/device_hardware_catalog.dart`; if architecture is unclear, map to `DeviceArchitecture.unknown` (never guess) | |
| - [ ] Review generated Dart diff in `lib/generated/meshtastic/` for unexpected field reorderings | |
| - [ ] Update any app code affected by new PortNum / message type changes (search for `default:` in `lib/services/protocol/protocol_service.dart` portnum switch) | |
| - [ ] Spot-check upstream iOS context (mandatory) — run `git -C meshtastic-ios log --oneline --since="3 months ago" --all | grep -iE "proto|hwmodel|hardware|portnum"` and record the outcome; mirror any commit that changes how a field is parsed, defaulted, or bounded before closing | |
| - [ ] Test with a physical Meshtastic device | |
| - [ ] Commit and push changes (use `Closes #<issue>` in the commit message to auto-close) | |
| - [ ] Close out (mandatory, only when 100% complete) — post a completion comment summarising the wire change, each new-hwModel architecture decision + why, the verification run, and the iOS spot-check outcome; tick only the boxes genuinely done (annotate, don't false-tick); then close the issue | |
| See `CLAUDE.md` → "Meshtastic Protobuf Updates" for the full workflow and rationale. | |
| --- | |
| *This issue was automatically created by the protobuf update checker.* | |
| EOF | |
| # Replace placeholders with actual values | |
| sed -i "s/CURRENT_PLACEHOLDER/$CURRENT_VERSION/g" /tmp/issue_body.md | |
| sed -i "s/LATEST_PLACEHOLDER/$LATEST_VERSION/g" /tmp/issue_body.md | |
| gh issue create \ | |
| --title "Update Meshtastic Protobufs to $LATEST_VERSION" \ | |
| --label "protobuf-update,enhancement" \ | |
| --body-file /tmp/issue_body.md | |
| - name: Summary | |
| env: | |
| CURRENT_VERSION: ${{ steps.current.outputs.version }} | |
| LATEST_VERSION: ${{ steps.latest.outputs.version }} | |
| NEEDS_UPDATE: ${{ steps.compare.outputs.needs_update }} | |
| run: | | |
| echo "## Protobuf Version Check" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "| | Version |" >> $GITHUB_STEP_SUMMARY | |
| echo "|---|---|" >> $GITHUB_STEP_SUMMARY | |
| echo "| Current | \`$CURRENT_VERSION\` |" >> $GITHUB_STEP_SUMMARY | |
| echo "| Latest | \`$LATEST_VERSION\` |" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| if [ "$NEEDS_UPDATE" = "true" ]; then | |
| echo "**Update available!**" >> $GITHUB_STEP_SUMMARY | |
| else | |
| echo "**Up to date**" >> $GITHUB_STEP_SUMMARY | |
| fi |