fix: fully version schema #168
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "PR checks" | |
on: | |
pull_request: | |
permissions: | |
contents: read | |
env: | |
GO_VERSION: 1.22 | |
jobs: | |
lint-protos: | |
runs-on: ubuntu-latest | |
steps: | |
# Install the `buf` CLI | |
- uses: bufbuild/buf-setup-action@v1 | |
with: | |
github_token: ${{ github.token }} | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
# Lint your Protobuf sources | |
- uses: bufbuild/buf-lint-action@v1 | |
with: | |
input: protobuf | |
buf-format: | |
runs-on: ubuntu-latest | |
steps: | |
# Install the `buf` CLI | |
- uses: bufbuild/buf-setup-action@v1 | |
with: | |
github_token: ${{ github.token }} | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Buf format check | |
run: buf format -d --exit-code | |
buf-breaking-changes: | |
runs-on: ubuntu-latest | |
steps: | |
# Install the `buf` CLI | |
- uses: bufbuild/buf-setup-action@v1 | |
with: | |
github_token: ${{ github.token }} | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
# Run breaking change detection against the last commit | |
- uses: bufbuild/buf-breaking-action@v1 | |
with: | |
input: protobuf | |
against: 'https://github.com/open-feature/schemas.git#branch=main,ref=HEAD~1,subdir=protobuf' | |
validate-and-sync-schema: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.head.ref }} | |
# Use ajv to validate schema | |
- name: Setup node | |
uses: actions/setup-node@v4.0.1 | |
- name: Validate schema | |
run: make ajv-validate-flagd-schema | |
# Run go test suite to validate the json schema against positive and/or negative validations in /json/test | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- name: Validate Schema | |
run: make test | |
# Sync JSON schemas from YAML versions | |
- name: Sync JSON from YAML | |
run: | | |
make gen-schema-json | |
if [ ! -z "$(git status --porcelain)" ]; then | |
echo "JSON schema generation produced diff, regenerating and committing result..."; | |
git config --global user.name "validate-and-sync-schema-job" | |
git config --global user.email "bot@openfeature.dev" | |
git add json/*.json && git commit --amend --no-edit | |
git push | |
else | |
echo "No delta between YAML and JSON schemas, finishing..." | |
fi | |