-
Notifications
You must be signed in to change notification settings - Fork 45
Ramsess/add casing check to metadata #1094
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
be88699
add scripts for casing validation, add action for pr's, add base type…
ramsessanchez d4216b0
Merge remote-tracking branch 'origin/master' into ramsess/addCasingCh…
ramsessanchez 752c775
update baseline schemas
ramsessanchez d502304
include version in violation messages
ramsessanchez 1ef9981
add explicit gh actions permissions
ramsessanchez 436c3e6
Merge branch 'master' into ramsess/addCasingCheckToMetadata
ramsessanchez 0a82473
update baseline types
ramsessanchez File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,80 @@ | ||
| # Validates that PRs don't introduce unintentional casing changes to type/enum names, | ||
| # members, or properties in CSDL schema files. After a PR merges, automatically | ||
| # regenerates the type-mapping baseline files to keep them current. | ||
|
|
||
| name: Check type and enum casing changes | ||
|
|
||
| on: | ||
| push: | ||
| branches: [ master ] | ||
| paths: | ||
| - 'schemas/*-Prod.csdl' | ||
| pull_request: | ||
| branches: [ master ] | ||
| paths: | ||
| - 'schemas/*-Prod.csdl' | ||
|
|
||
| jobs: | ||
| # Runs on PRs: compares modified CSDL files against the committed type-mapping | ||
| # JSON baselines. Fails if any name matches case-insensitively but differs | ||
| # case-sensitively (e.g., "accessLevel" -> "AccessLevel"). New types are allowed. | ||
| check-casing: | ||
| if: github.event_name == 'pull_request' | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v6 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Determine modified Prod CSDL files | ||
| id: changed-files | ||
| run: | | ||
| FILES=$(git diff --diff-filter=ACMR --name-only origin/${{ github.base_ref }}...HEAD -- 'schemas/*-Prod.csdl' | tr '\n' ',' | sed 's/,$//') | ||
| echo "files=$FILES" >> $GITHUB_OUTPUT | ||
| echo "Modified CSDL files: $FILES" | ||
|
|
||
| - name: Check for casing changes | ||
| if: steps.changed-files.outputs.files != '' | ||
| shell: pwsh | ||
| run: | | ||
| $files = "${{ steps.changed-files.outputs.files }}" -split ',' | ||
| ./scripts/check-casing-changes.ps1 -CsdlFiles $files | ||
|
|
||
| # Runs on push to master (after PR merge): regenerates the type-mapping baseline | ||
| # JSON files from the updated CSDL schemas and auto-commits them if changed. | ||
| # This keeps baselines current so future PRs are checked against the latest state. | ||
| update-baselines: | ||
| if: github.event_name == 'push' | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: write | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v6 | ||
|
|
||
| - name: Regenerate type mapping baselines | ||
| shell: pwsh | ||
| run: ./scripts/generate-type-mappings.ps1 | ||
|
|
||
| - name: Check for changes | ||
| id: check-changes | ||
| run: | | ||
| if git diff --quiet schemas/type-mappings/; then | ||
| echo "changed=false" >> $GITHUB_OUTPUT | ||
| echo "No baseline changes detected." | ||
| else | ||
| echo "changed=true" >> $GITHUB_OUTPUT | ||
| echo "Baseline changes detected." | ||
| fi | ||
|
|
||
| - name: Commit updated baselines | ||
| if: steps.check-changes.outputs.changed == 'true' | ||
| run: | | ||
| git config user.name "github-actions[bot]" | ||
| git config user.email "github-actions[bot]@users.noreply.github.com" | ||
| git add schemas/type-mappings/ | ||
| git commit -m "Update type mapping baselines | ||
|
|
||
| Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>" | ||
| git push | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.