@@ -12,17 +12,16 @@ jobs:
1212 generate :
1313 runs-on : ubuntu-24.04
1414 permissions :
15- contents : write
15+ contents : read # checkout + read-only `git fetch origin main` for the verify step
1616 steps :
1717 - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
1818 with :
1919 ref : ${{ github.ref }}
20- # zizmor: ignore[artipacked] -- needs credentials to push
21- persist-credentials : true
20+ persist-credentials : false
2221 - uses : jdx/mise-action@1648a7812b9aeae629881980618f079932869151 # v4.0.1
2322 with :
24- version : v2026.5.11
25- sha256 : 9bb41ae4dbe2bcdfdbe36cf3c737a8bdb72035c03af3b7218a70780988f62b9b
23+ version : v2026.5.18
24+ sha256 : cfac593469d028d7ae5fe36e37bd7c59118b5238e92d8a876209578464f24a84
2625 - name : Cache local Maven repository
2726 uses : actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
2827 with :
@@ -45,18 +44,48 @@ jobs:
4544 fi
4645 - name : Generate protobuf sources
4746 run : mise run generate
48- - name : Commit and push generated sources
47+ - name : Validate and export generated sources as a patch
4948 run : |
50- git diff --quiet && exit 0
5149 UNEXPECTED=$(git diff --name-only | grep -v '\.java$' || true)
5250 if [[ -n "$UNEXPECTED" ]]; then
5351 echo "::error::Unexpected files changed:"
5452 echo "$UNEXPECTED"
5553 exit 1
5654 fi
55+ git diff --binary > /tmp/protobuf-sources.patch
56+ - name : Upload generated patch
57+ uses : actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
58+ with :
59+ name : protobuf-sources-patch
60+ path : /tmp/protobuf-sources.patch
61+ retention-days : 5
62+
63+ publish :
64+ runs-on : ubuntu-24.04
65+ needs : generate
66+ permissions :
67+ contents : write # push regenerated sources back to the renovate branch
68+ steps :
69+ - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
70+ with :
71+ ref : ${{ github.ref }}
72+ # zizmor: ignore[artipacked] -- needs credentials to push
73+ persist-credentials : true
74+ - name : Download generated patch
75+ uses : actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
76+ with :
77+ name : protobuf-sources-patch
78+ path : /tmp/patch
79+ - name : Commit and push generated sources
80+ run : |
81+ PATCH=/tmp/patch/protobuf-sources.patch
82+ if [[ ! -s "$PATCH" ]]; then
83+ echo "No generated changes to commit"
84+ exit 0
85+ fi
86+ git apply "$PATCH"
5787 # Note: GITHUB_TOKEN pushes don't trigger CI re-runs.
5888 # Close and reopen the PR to trigger CI after this commit.
59- # TODO: switch to PROMBOT_GITHUB_TOKEN once it's added to this repo.
6089 git config user.name "github-actions[bot]"
6190 git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
6291 git add '*.java'
0 commit comments