Skip to content

Bump BBS Protos

Bump BBS Protos #7

name: Bump BBS Protos
on:
workflow_dispatch:
schedule:
- cron: '0 0 * * *' # Runs daily at midnight
jobs:
update-protos:
runs-on: ubuntu-latest
steps:
- uses: hmarr/debug-action@v3
- name: Checkout ccng
uses: actions/checkout@v4
with:
path: cloud_controller_ng
- name: Clone bbs repository
uses: actions/checkout@v4
with:
repository: cloudfoundry/bbs
path: bbs
- name: Install protoc
run: |
wget -q -O /tmp/protoc.zip https://github.com/protocolbuffers/protobuf/releases/download/v3.6.1/protoc-3.6.1-linux-x86_64.zip
sudo unzip -q /tmp/protoc.zip -d /usr/local
rm /tmp/protoc.zip
wget -q -O /tmp/protobuf.zip https://github.com/protocolbuffers/protobuf/archive/v3.6.1.zip
unzip -q /tmp/protobuf.zip -d /tmp
sudo cp -r /tmp/protobuf-3.6.1/src/google /usr/local/include/
sudo chmod -R 755 /usr/local/include/google
rm -rf /tmp/protobuf.zip /tmp/protobuf-3.6.1
export PATH=$PATH:/usr/local/bin
- name: Clone gogo/protobuf
run: |
PROTO_SRC=$(mktemp -d)
git clone https://github.com/gogo/protobuf.git "$PROTO_SRC/github.com/gogo/protobuf"
echo "PROTO_SRC=$PROTO_SRC" >> $GITHUB_ENV
- name: Generate Ruby files from protos
run: |
RUBY_OUT=$(mktemp -d)
pushd bbs > /dev/null
sed -i'' -e 's/package models/package diego.bbs.models/' models/*.proto
protoc --proto_path="$PROTO_SRC":models --ruby_out="$RUBY_OUT" models/*.proto
popd > /dev/null
cp -r "$RUBY_OUT/." cloud_controller_ng/lib/diego/bbs/models
- name: Check for changes
id: check_changes
run: |
pushd cloud_controller_ng > /dev/null
if git diff --quiet; then
echo "No changes detected."
echo "changes=false" >> $GITHUB_ENV
else
echo "Changes detected."
echo "changes=true" >> $GITHUB_ENV
fi
popd > /dev/null
- name: Commit changes
if: env.changes == 'true'
run: |
pushd cloud_controller_ng > /dev/null
git config user.name "ari-wg-gitbot"
git config user.email "[email protected]"
git add .
git commit -m "Bump BBS protos"
popd > /dev/null
- name: Create or Update Pull Request
if: env.changes == 'true'
uses: peter-evans/create-pull-request@v7
with:
path: cloud_controller_ng
branch: bbs-protos-bump-${{ github.ref_name }}
title: "Automated Update of BBS Protobuf Resources"
body: |
This PR contains updates to the bbs protobuf resources.
Please review carefully before merging.
labels: "bump_bbs_protos, needs_review"
commit-message: "Bump BBS protos"
committer: "ari-wg-gitbot <[email protected]>"
author: "ari-wg-gitbot <[email protected]>"