Skip to content

Commit

Permalink
Ensure generated code is up-to-date on PRs (#692) (#698)
Browse files Browse the repository at this point in the history
Doesn't pull new versions of spec, merely ensures changes to generator have been captured or manual changes haven't been made to generated code.

Signed-off-by: Thomas Farr <tsfarr@amazon.com>
(cherry picked from commit 3864d48)

Co-authored-by: Thomas Farr <tsfarr@amazon.com>
  • Loading branch information
opensearch-trigger-bot[bot] and Xtansia authored Jul 8, 2024
1 parent f705c46 commit 0c56399
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/code-gen.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Code Generation

on: [pull_request]

jobs:
up_to_date:
name: Ensure Generated Code Up To Date
runs-on: ubuntu-latest
steps:
- name: Checkout .NET Client
uses: actions/checkout@v4

- name: Setup .NET SDK
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
5.0.x
6.0.x
- name: Cache Nuget Packages
uses: actions/cache@v3
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.?sproj') }}
restore-keys: |
${{ runner.os }}-nuget-
- name: Run Code Generator
run: ./build.sh codegen --branch main

- name: Check For Uncommitted Changes
shell: bash -eo pipefail {0}
run: |
output=$(git status --porcelain)
if [ -z "$output" ]; then
echo "Clean working directory"
exit 0
else
echo "Dirty working directory"
echo "$output"
exit 1
fi

0 comments on commit 0c56399

Please sign in to comment.