Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: check PRs for spec changes #137

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions .github/workflows/spec-change.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Spec change check

on:
pull_request:
types: [opened, synchronize, labeled, unlabeled]
push:

jobs:
check:
runs-on: ubuntu-latest
# Skip this job if the PR has the `spec-change` label
if: ${{ !contains(github.event.pull_request.labels.*.name, 'spec-change') }}

steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable

- name: Install Protoc
run: |
PROTOC_VERSION=3.20.1
PROTOC_ARCH=linux-x86_64
PROTOC_ZIP=protoc-$PROTOC_VERSION-$PROTOC_ARCH.zip
curl --retry 3 --retry-max-time 90 -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" -OL https://github.com/protocolbuffers/protobuf/releases/download/v$PROTOC_VERSION/$PROTOC_ZIP
sudo unzip -o $PROTOC_ZIP -d /usr/local bin/protoc
sudo unzip -o $PROTOC_ZIP -d /usr/local 'include/*'
rm -f $PROTOC_ZIP
echo "PROTOC=/usr/local/bin/protoc" >> $GITHUB_ENV
echo "PROTOC_INCLUDE=/usr/local/include" >> $GITHUB_ENV

- name: check for spec changes
run: |
cargo run --bin crdgen > crdgen.yaml
diff crdgen.yaml ./k8s/crds/v1alpha1.yaml > diff.txt
if [ -s diff.txt ]; then
echo "Files are different"
echo "::set-output name=DIFF::$(cat diff.txt)"
exit 1
else
echo "no diff"
fi

Loading
Loading