-
Notifications
You must be signed in to change notification settings - Fork 828
64 lines (61 loc) · 2.27 KB
/
generate-protobuf.yml
File metadata and controls
64 lines (61 loc) · 2.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
---
name: Generate Protobuf
on:
push:
branches:
- "renovate/protobuf"
permissions: {}
jobs:
generate:
runs-on: ubuntu-24.04
permissions:
contents: write
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
ref: ${{ github.ref }}
# zizmor: ignore[artipacked] -- needs credentials to push
persist-credentials: true
- uses: jdx/mise-action@1648a7812b9aeae629881980618f079932869151 # v4.0.1
with:
version: v2026.4.18
sha256: 6ae2d5f0f23a2f2149bc5d9bf264fe0922a1da843f1903e453516c462b23cc1f
- name: Cache local Maven repository
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Verify both protobuf deps are updated
run: |
git fetch origin main
DIFF_POM=$(git diff origin/main -- pom.xml)
DIFF_MISE=$(git diff origin/main -- mise.toml)
if ! echo "$DIFF_POM" | grep -q 'protobuf-java.version'; then
echo "::error::protobuf-java not updated in pom.xml"
exit 1
fi
if ! echo "$DIFF_MISE" | grep -q 'protoc'; then
echo "::error::protoc not updated in mise.toml"
exit 1
fi
- name: Generate protobuf sources
run: mise run generate
- name: Commit and push generated sources
run: |
git diff --quiet && exit 0
UNEXPECTED=$(git diff --name-only | grep -v '\.java$' || true)
if [[ -n "$UNEXPECTED" ]]; then
echo "::error::Unexpected files changed:"
echo "$UNEXPECTED"
exit 1
fi
# Note: GITHUB_TOKEN pushes don't trigger CI re-runs.
# Close and reopen the PR to trigger CI after this commit.
# TODO: switch to PROMBOT_GITHUB_TOKEN once it's added to this repo.
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add '*.java'
git commit -m "chore: regenerate protobuf sources"
git push