openai/openai-dotnet

Public

mirrored from https://github.com/openai/openai-dotnetAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
joseharriaga/MessageResponseItem

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

.github/workflows/codegen-validation.yml

86lines · modecode

1# This workflow validates changes made to the codegen folder by running code generation
2# and ensuring the process completes successfully without errors.
3name: CodeGen Validation
4
5on:
6 pull_request:
7 paths:
8 - 'codegen/**'
9 - 'specification/**'
10 - 'src/**'
11 - 'package.json'
12 - 'global.json'
13 - 'package-lock.json'
14 - '.github/workflows/codegen-validation.yml'
15 - 'scripts/Invoke-CodeGen.ps1'
16 types: [opened, reopened, synchronize]
17 workflow_dispatch:
18
19jobs:
20 validate-codegen:
21 name: Validate Code Generation
22 runs-on: ubuntu-latest
23
24 steps:
25 - name: Checkout code
26 uses: actions/checkout@v4
27
28 - name: Setup Node.js
29 uses: actions/setup-node@v4
30 with:
31 node-version: '22.x'
32
33 - name: Setup .NET
34 uses: actions/setup-dotnet@v4
35 with:
36 # Use the version specified in global.json
37 global-json-file: global.json
38
39 - name: Run CodeGen Script
40 shell: pwsh
41 run: |
42 Write-Host "Running code generation validation..."
43 ./scripts/Invoke-CodeGen.ps1 -Clean
44
45 if ($LASTEXITCODE -ne 0) {
46 Write-Error "Code generation failed with exit code: $LASTEXITCODE"
47 exit $LASTEXITCODE
48 }
49
50 Write-Host "Code generation completed successfully!"
51
52 - name: Check for uncommitted changes
53 run: |
54 # Check if there are any changes to tracked files after code generation
55 if ! git diff --quiet; then
56 echo "::error::Code generation produced uncommitted changes. Please run the codegen script locally and commit the results."
57 echo "Changed files:"
58 git diff --name-only
59 echo "Diff details:"
60 git diff
61 exit 1
62 fi
63
64 # Also check for untracked files that might have been generated
65 if [ -n "$(git ls-files --others --exclude-standard)" ]; then
66 echo "::error::Code generation produced untracked files. Please review and commit them if they should be included."
67 echo "Untracked files:"
68 git ls-files --others --exclude-standard
69 exit 1
70 fi
71
72 echo "No uncommitted changes detected - code generation is up to date!"
73
74 - name: Run codegen visitor tests
75 run: dotnet test codegen/generator/test/
76 --configuration Release
77 --logger "trx;LogFilePrefix=codegen"
78 --results-directory ${{github.workspace}}/artifacts/test-results
79 ${{ env.version_suffix_args}}
80
81 - name: Upload artifacts
82 uses: actions/upload-artifact@v4
83 if: ${{ !cancelled() }}
84 with:
85 name: build-artifacts
86 path: ${{github.workspace}}/artifacts