-
Notifications
You must be signed in to change notification settings - Fork 364
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into fix-wms-nested-ids
- Loading branch information
Showing
14 changed files
with
1,391 additions
and
585 deletions.
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
.github/workflows/find-region-mapping-alias-duplicates.yml
This file contains 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,34 @@ | ||
name: Find region mapping alias duplicates | ||
|
||
# Run when regionMapping.json file or is updated | ||
on: | ||
push: | ||
paths: | ||
- "wwwroot/data/regionMapping.json" | ||
- "buildprocess/find-region-mapping-alias-duplicates.js" | ||
pull_request: | ||
paths: | ||
- "wwwroot/data/regionMapping.json" | ||
- "buildprocess/find-region-mapping-alias-duplicates.js" | ||
|
||
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | ||
jobs: | ||
# This workflow contains a single job | ||
find-alias-duplicates: | ||
# The type of runner that the job will run on | ||
runs-on: ubuntu-latest | ||
|
||
# Steps represent a sequence of tasks that will be executed as part of the job | ||
steps: | ||
# Check out only 2 files | ||
# Use without cone mode as no git operations are executed past checkout | ||
- uses: actions/checkout@v4 | ||
with: | ||
sparse-checkout: | | ||
wwwroot/data/regionMapping.json | ||
buildprocess/find-region-mapping-alias-duplicates.js | ||
sparse-checkout-cone-mode: false | ||
|
||
- name: Check aliases | ||
run: | | ||
node buildprocess/find-region-mapping-alias-duplicates.js |
This file contains 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 file contains 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,22 @@ | ||
const fs = require("fs"); | ||
const regions = JSON.parse( | ||
fs.readFileSync("wwwroot/data/regionMapping.json") | ||
).regionWmsMap; | ||
|
||
const aliasToType = new Map(); | ||
for (const [regType, regDef] of Object.entries(regions)) { | ||
for (const alias of regDef.aliases ?? []) { | ||
aliasToType.set(alias, [...(aliasToType.get(alias) ?? []), regType]); | ||
} | ||
} | ||
|
||
let issues = 0; | ||
for (const [alias, regTypes] of aliasToType.entries()) { | ||
if (regTypes.length > 1) { | ||
console.error( | ||
`Alias "${alias}" used in multiple types: ${regTypes.join(", ")}` | ||
); | ||
issues++; | ||
} | ||
} | ||
process.exitCode = issues > 0 ? 1 : 0; |
This file contains 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
Oops, something went wrong.