-
Notifications
You must be signed in to change notification settings - Fork 835
88 lines (84 loc) · 3.15 KB
/
Copy pathregenerate-api-diff-otel.yml
File metadata and controls
88 lines (84 loc) · 3.15 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
---
name: Regenerate API Diff (OTel update)
on:
push:
branches:
- "renovate/otel.instrumentation.version"
permissions: {}
jobs:
generate:
runs-on: ubuntu-24.04
permissions:
contents: read # checkout + read-only `git fetch origin main` for the verify step
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
ref: ${{ github.ref }}
persist-credentials: false
- uses: jdx/mise-action@c2a87611a18de5b3828c5652fe268e992400cb5c # v4.3.0
with:
version: v2026.8.11
sha256: 3d825b8341925abb398fba6fd8dcd7d6e92ade6820d892da62992e0765638e66
- name: Cache local Maven repository
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Verify OTel instrumentation version was updated
run: |
git fetch origin main
DIFF_POM=$(git diff origin/main -- pom.xml)
if ! echo "$DIFF_POM" | grep -q 'otel.instrumentation.version'; then
echo "::error::otel.instrumentation.version not updated in pom.xml"
exit 1
fi
- name: Regenerate API diff
run: mise run api-diff
- name: Validate and export apidiff changes as a patch
run: |
UNEXPECTED=$(git diff --name-only | grep -v '^docs/apidiffs/' || true)
if [[ -n "$UNEXPECTED" ]]; then
echo "::error::Unexpected files changed:"
echo "$UNEXPECTED"
exit 1
fi
git diff --binary -- docs/apidiffs > /tmp/apidiffs.patch
- name: Upload generated patch
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: apidiffs-patch
path: /tmp/apidiffs.patch
retention-days: 5
publish:
runs-on: ubuntu-24.04
needs: generate
permissions:
contents: write # push regenerated apidiffs back to the renovate branch
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
ref: ${{ github.ref }}
# zizmor: ignore[artipacked] -- needs credentials to push
persist-credentials: true
- name: Download generated patch
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: apidiffs-patch
path: /tmp/patch
- name: Commit and push regenerated apidiffs
run: |
PATCH=/tmp/patch/apidiffs.patch
if [[ ! -s "$PATCH" ]]; then
echo "No apidiff changes to commit"
exit 0
fi
git apply "$PATCH"
# Note: GITHUB_TOKEN pushes don't trigger CI re-runs.
# Close and reopen the PR to trigger CI after this commit.
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add docs/apidiffs
git commit -m "chore: regenerate api diff"
git push