Fix: Extract filename from filepath in UploadFile methods #280
This file contains hidden or 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
| # This workflow validates code generation and API export integrity by running | |
| # the relevant scripts and ensuring they complete without producing changes. | |
| name: Code integrity checks | |
| on: | |
| pull_request: | |
| paths: | |
| - 'codegen/**' | |
| - 'specification/**' | |
| - 'src/**' | |
| - 'package.json' | |
| - 'global.json' | |
| - 'package-lock.json' | |
| - '.github/workflows/codegen-validation.yml' | |
| - 'scripts/Invoke-CodeGen.ps1' | |
| - 'scripts/Export-Api.ps1' | |
| - 'api/**' | |
| - 'Directory.Build.targets' | |
| types: [opened, reopened, synchronize] | |
| workflow_dispatch: | |
| jobs: | |
| validate-codegen: | |
| name: Validate code generation | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: '22.x' | |
| - name: Set up .NET | |
| uses: actions/setup-dotnet@v5 | |
| with: | |
| # Use the version specified in global.json | |
| global-json-file: global.json | |
| - name: Run Invoke-CodeGen script | |
| shell: pwsh | |
| run: | | |
| Write-Host "Running code generation validation..." | |
| ./scripts/Invoke-CodeGen.ps1 -Clean | |
| 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: | | |
| CODEGEN_ERROR_MSG="Code generation produced changes. Please run './scripts/Invoke-CodeGen.ps1' locally and commit the results." | |
| # Check if there are any changes to tracked files after code generation | |
| if ! git diff --quiet; then | |
| echo "::error::$CODEGEN_ERROR_MSG" | |
| 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::$CODEGEN_ERROR_MSG" | |
| echo "Untracked files:" | |
| git ls-files --others --exclude-standard | |
| exit 1 | |
| fi | |
| echo "No uncommitted changes detected - code generation is up to date!" | |
| - name: Run codegen visitor tests | |
| run: dotnet test codegen/generator/test/ | |
| --configuration Release | |
| --logger "trx;LogFilePrefix=codegen" | |
| --results-directory ${{github.workspace}}/artifacts/test-results | |
| ${{ env.version_suffix_args}} | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v6 | |
| if: ${{ !cancelled() }} | |
| with: | |
| name: build-artifacts | |
| path: ${{github.workspace}}/artifacts | |
| validate-api-export: | |
| name: Validate API export | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Set up .NET | |
| uses: actions/setup-dotnet@v5 | |
| with: | |
| # Use the version specified in global.json | |
| global-json-file: global.json | |
| - name: Run Export-Api script | |
| shell: pwsh | |
| run: | | |
| Write-Host "Running API export validation..." | |
| ./scripts/Export-Api.ps1 | |
| if ($LASTEXITCODE -ne 0) { | |
| Write-Error "API export failed with exit code: $LASTEXITCODE" | |
| exit $LASTEXITCODE | |
| } | |
| Write-Host "API export completed successfully!" | |
| - name: Check for uncommitted changes | |
| run: | | |
| API_ERROR_MSG="API export produced changes. Please run './scripts/Export-Api.ps1' locally and commit the results." | |
| # Check if there are any changes to tracked files after API export | |
| if ! git diff --quiet; then | |
| echo "::error::$API_ERROR_MSG" | |
| 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::$API_ERROR_MSG" | |
| echo "Untracked files:" | |
| git ls-files --others --exclude-standard | |
| exit 1 | |
| fi | |
| echo "No uncommitted changes detected - API export is up to date!" |