Skip to content

Bump BBS Protos

Bump BBS Protos #352

name: Bump BBS Protos
on:
workflow_dispatch:
schedule:
- cron: '0 0 * * *' # Runs daily at midnight
jobs:
update-protos:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- uses: hmarr/debug-action@v3
- name: Checkout ccng
uses: actions/checkout@v5
with:
path: cloud_controller_ng
- name: Clone bbs repository
uses: actions/checkout@v5
with:
repository: cloudfoundry/bbs
path: bbs
- name: Install protoc
run: |
wget -q -O /tmp/protoc.zip https://github.com/protocolbuffers/protobuf/releases/download/v30.2/protoc-30.2-linux-x86_64.zip
unzip -q /tmp/protoc.zip -d /tmp/protoc
rm /tmp/protoc.zip
sudo mv /tmp/protoc/bin/protoc /usr/local/bin/protoc
sudo cp -r /tmp/protoc/include/google /usr/local/include/
sudo chmod -R 755 /usr/local/include/google
rm -rf /tmp/protoc
export PATH=$PATH:/usr/local/bin
- name: Generate Ruby files from protos
run: |
RUBY_OUT=$(mktemp -d)
pushd bbs > /dev/null
sed -i'' -E '/import.*gogoproto/d; /option.*gogoproto/d; s/\(gogoproto.*, //g; s/, \(gogoproto[^]]+//g; s/\[\(gogoproto[^]]*\]//g; s/package models/package diego.bbs.models/' models/*.proto
protoc --proto_path=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]>"