Add linter for when people generate proto files inside the PR (#84)

This commit is contained in:
Jesse Hills 2021-08-03 15:25:20 +12:00 committed by GitHub
parent 6230edcb9f
commit 1fbf0396fe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 37 additions and 0 deletions

37
.github/workflows/protoc-lint.yml vendored Normal file
View File

@ -0,0 +1,37 @@
name: Check protobuf generated files
on:
pull_request:
paths:
- aioesphomeapi/api_options_pb2.py
- aioesphomeapi/api_pb2.py
jobs:
protoc-update:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.7'
- name: Install protoc
run: |
sudo apt-get install protobuf-compiler
- name: Set up Python environment
run: |
pip3 install -e .
pip3 install -r requirements_test.txt
- name: Generate protoc
run: |
script/gen-protoc
- name: Check changes
run: |
if ! git diff --quiet; then
echo "You have altered the generated proto files but they do not match what is expected."
echo "Please check your local protobuf-compiler version."
protoc --version
exit 1
fi