Skip to content

Commit e578ff4

Browse files
committed
fix: regenerate protobuf sources in CI
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
1 parent f4180d0 commit e578ff4

2 files changed

Lines changed: 9 additions & 15269 deletions

File tree

  • .github/workflows
  • prometheus-metrics-exposition-formats/src/main/generated/io/prometheus/metrics/expositionformats/generated/com_google_protobuf_4_35_1

‎.github/workflows/generate-protobuf.yml‎

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,15 @@ jobs:
4646
run: mise run generate
4747
- name: Validate and export generated sources as a patch
4848
run: |
49-
UNEXPECTED=$(git diff --name-only | grep -v '\.java$' || true)
49+
CHANGED=$(git diff --name-only; git ls-files --others --exclude-standard)
50+
UNEXPECTED=$(echo "$CHANGED" | sed '/^$/d' | grep -v '\.java$' || true)
5051
if [[ -n "$UNEXPECTED" ]]; then
5152
echo "::error::Unexpected files changed:"
5253
echo "$UNEXPECTED"
5354
exit 1
5455
fi
55-
git diff --binary > /tmp/protobuf-sources.patch
56+
git add -A -- '*.java'
57+
git diff --cached --binary > /tmp/protobuf-sources.patch
5658
- name: Upload generated patch
5759
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
5860
with:
@@ -83,11 +85,14 @@ jobs:
8385
echo "No generated changes to commit"
8486
exit 0
8587
fi
86-
git apply "$PATCH"
88+
git apply --index "$PATCH"
89+
if git diff --cached --quiet; then
90+
echo "No generated changes to commit"
91+
exit 0
92+
fi
8793
# Note: GITHUB_TOKEN pushes don't trigger CI re-runs.
8894
# Close and reopen the PR to trigger CI after this commit.
8995
git config user.name "github-actions[bot]"
9096
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
91-
git add '*.java'
9297
git commit -m "chore: regenerate protobuf sources"
9398
git push

0 commit comments

Comments
 (0)