Skip to content

Commit d9fc85c

Browse files
committed
.github/workflows: automatically update jsonnet dependencies
This commit extends the versions github workflow to automatically update jsonnet dependencies when the jsonnet code in upstream repositories changes.
1 parent 2c5c20c commit d9fc85c

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

.github/workflows/versions.yaml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,26 @@ jobs:
1717
# Write to temporary file to make update atomic
1818
scripts/generate-versions.sh > /tmp/versions.json
1919
mv /tmp/versions.json jsonnet/kube-prometheus/versions.json
20+
- name: Install jsonnet bundler
21+
run: |
22+
go get github.com/jsonnet-bundler/jsonnet-bundler/cmd/jb
23+
- name: Update jsonnet dependencies
24+
run: |
25+
jb update
2026
make --always-make generate
27+
28+
# Reset jsonnetfile.lock.json if no dependencies were updated
29+
changedFiles=$(git diff --name-only | grep -v 'jsonnetfile.lock.json')
30+
if [[ $changedFiles == "" ]]; then
31+
git checkout -- jsonnetfile.lock.json;
32+
fi
2133
- name: Create Pull Request
2234
uses: peter-evans/create-pull-request@v3
2335
with:
2436
commit-message: "[bot] Automated version update"
2537
title: "[bot] Automated version update"
2638
body: |
27-
This is an automated version update performed from CI on behalf of @paulfantom.
39+
This is an automated version and jsonnet dependencies update performed from CI on behalf of @paulfantom.
2840
2941
Configuration of the workflow is located in `.github/workflows/versions.yaml`
3042
team-reviewers: kube-prometheus-reviewers

0 commit comments

Comments
 (0)