Skip to content

Commit 29fbe72

Browse files
authored
Add workflow to bump BBS protos (#4022)
1 parent dc6edb0 commit 29fbe72

File tree

1 file changed

+78
-0
lines changed

1 file changed

+78
-0
lines changed

.github/workflows/bump_bbs_protos.yml

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
name: Bump BBS Protos
2+
3+
on:
4+
workflow_dispatch:
5+
schedule:
6+
- cron: '0 0 * * *' # Runs daily, adjust as needed
7+
8+
jobs:
9+
update-protos:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout ccng
14+
uses: actions/checkout@v3
15+
16+
- name: Clone bbs repository
17+
run: |
18+
git clone --depth=1 https://github.com/cloudfoundry/bbs.git
19+
echo "BBS_REPO_PATH=$(pwd)/bbs" >> $GITHUB_ENV
20+
21+
- name: Install protoc
22+
run: |
23+
wget -q -O /tmp/protoc.zip https://github.com/protocolbuffers/protobuf/releases/download/v3.6.1/protoc-3.6.1-linux-x86_64.zip
24+
unzip -q /tmp/protoc.zip -d /usr/local
25+
rm /tmp/protoc.zip
26+
export PATH=$PATH:/usr/local/bin
27+
28+
- name: Clone gogo/protobuf
29+
run: |
30+
PROTO_SRC=$(mktemp -d)
31+
git clone https://github.com/gogo/protobuf.git "$PROTO_SRC/github.com/gogo/protobuf"
32+
echo "PROTO_SRC=$PROTO_SRC" >> $GITHUB_ENV
33+
34+
- name: Generate Ruby files from protos
35+
run: |
36+
RUBY_OUT=$(mktemp -d)
37+
pushd $BBS_REPO_PATH/models > /dev/null
38+
sed -i'' -e 's/package models/package diego.bbs.models/' models/*.proto
39+
protoc --proto_path="$PROTO_SRC":models --ruby_out="$RUBY_OUT" models/*.proto
40+
popd > /dev/null
41+
cp -r "$RUBY_OUT/." cloud_controller_ng/lib/diego/bbs/models
42+
43+
- name: Check for changes
44+
id: check_changes
45+
run: |
46+
pushd cloud_controller_ng > /dev/null
47+
if git diff --quiet; then
48+
echo "No changes detected."
49+
echo "changes=false" >> $GITHUB_ENV
50+
else
51+
echo "Changes detected."
52+
echo "changes=true" >> $GITHUB_ENV
53+
fi
54+
popd > /dev/null
55+
56+
- name: Commit changes
57+
if: env.changes == 'true'
58+
run: |
59+
pushd cloud_controller_ng > /dev/null
60+
git config user.name "ari-wg-gitbot"
61+
git config user.email "[email protected]"
62+
git add .
63+
git commit -m "Bump BBS protos"
64+
popd > /dev/null
65+
66+
- name: Create or Update Pull Request
67+
if: env.changes == 'true'
68+
uses: peter-evans/create-pull-request@v7
69+
with:
70+
branch: bbs-protos
71+
base: main
72+
title: "Automated Update of BBS Protobuf Resources"
73+
body: |
74+
This PR contains updates to the bbs protobuf resources.
75+
Please review carefully before merging.
76+
labels: "bump_bbs_protos, needs_review"
77+
commit-message: "Bump BBS protos"
78+
author: "ari-wg-gitbot <[email protected]>"

0 commit comments

Comments
 (0)