Skip to content

Commit 97b9360

Browse files
committed
Regen-protobufs
1 parent 68111e3 commit 97b9360

File tree

2 files changed

+68
-1
lines changed

2 files changed

+68
-1
lines changed

.github/workflows/regen-protobufs.yml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: Regenerate Protobufs
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
regenerate-protobufs:
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- name: Checkout repository
12+
uses: actions/checkout@v4
13+
with:
14+
submodules: recursive
15+
token: ${{ secrets.GITHUB_TOKEN }}
16+
17+
- name: Setup .NET
18+
uses: actions/setup-dotnet@v4
19+
with:
20+
dotnet-version: 9.0.x
21+
22+
- name: Restore dependencies
23+
run: dotnet restore
24+
25+
- name: Regenerate protobuf files
26+
run: |
27+
# Navigate to protobufs/meshtastic and temporarily rename deviceonly.proto
28+
cd ./protobufs/meshtastic/
29+
mv deviceonly.proto deviceonly.ignoreproto
30+
cd ../../
31+
32+
# Use protoc from NuGet package (same as existing scripts)
33+
~/.nuget/packages/google.protobuf.tools/3.29.3/tools/linux_x64/protoc -I=protobufs --csharp_out=./Meshtastic/Generated --csharp_opt=base_namespace=Meshtastic.Protobufs ./protobufs/meshtastic/*.proto
34+
35+
# Restore deviceonly.proto
36+
cd ./protobufs/meshtastic/
37+
mv deviceonly.ignoreproto deviceonly.proto
38+
cd ../../
39+
40+
- name: Check for changes
41+
id: verify-changed-files
42+
run: |
43+
if [ -n "$(git status --porcelain)" ]; then
44+
echo "changed=true" >> $GITHUB_OUTPUT
45+
else
46+
echo "changed=false" >> $GITHUB_OUTPUT
47+
fi
48+
49+
- name: Commit and create pull request
50+
if: steps.verify-changed-files.outputs.changed == 'true'
51+
uses: peter-evans/create-pull-request@v6
52+
with:
53+
token: ${{ secrets.GITHUB_TOKEN }}
54+
commit-message: 'chore: regenerate protobuf files'
55+
title: 'chore: regenerate protobuf files'
56+
body: |
57+
This pull request contains updated C# protobuf files generated from the latest proto definitions.
58+
59+
Generated by the "Regenerate Protobufs" GitHub Action workflow.
60+
branch: regen-protobufs
61+
delete-branch: true
62+
add-paths: |
63+
Meshtastic/Generated/
64+
65+
- name: No changes detected
66+
if: steps.verify-changed-files.outputs.changed == 'false'
67+
run: echo "No changes detected in generated protobuf files."

0 commit comments

Comments
 (0)