Skip to content
Merged
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
67 changes: 67 additions & 0 deletions .github/workflows/codegen-validation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# This workflow validates changes made to the codegen folder by running code generation
# and ensuring the process completes successfully without errors.
name: CodeGen Validation

on:
pull_request:
paths:
- 'codegen/**'
- '.github/workflows/codegen-validation.yml'
- 'scripts/Invoke-CodeGen.ps1'
types: [opened, reopened, synchronize]
workflow_dispatch:

jobs:
validate-codegen:
name: Validate Code Generation
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22.x'

- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
# Use the version specified in global.json
global-json-file: global.json

- name: Run CodeGen Script
shell: pwsh
run: |
Write-Host "Running code generation validation..."
./scripts/Invoke-CodeGen.ps1

if ($LASTEXITCODE -ne 0) {
Write-Error "Code generation failed with exit code: $LASTEXITCODE"
exit $LASTEXITCODE
}

Write-Host "Code generation completed successfully!"

- name: Check for uncommitted changes
run: |
# Check if there are any changes to tracked files after code generation
if ! git diff --quiet; then
echo "::error::Code generation produced uncommitted changes. Please run the codegen script locally and commit the results."
echo "Changed files:"
git diff --name-only
echo "Diff details:"
git diff
exit 1
fi

# Also check for untracked files that might have been generated
if [ -n "$(git ls-files --others --exclude-standard)" ]; then
echo "::error::Code generation produced untracked files. Please review and commit them if they should be included."
echo "Untracked files:"
git ls-files --others --exclude-standard
exit 1
fi

echo "No uncommitted changes detected - code generation is up to date!"
Loading