Skip to content

Commit f2d4e39

Browse files
committed
add YAML format and sort check workflow with formatting script
1 parent d3e7d9b commit f2d4e39

6 files changed

Lines changed: 386 additions & 118 deletions

File tree

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: YAML Format & Sort Check
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
jobs:
8+
yaml-format-check:
9+
runs-on: ubuntu-latest
10+
name: Check YAML formatting and sorting
11+
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v3
15+
16+
- name: Set up Node.js
17+
uses: actions/setup-node@v3
18+
with:
19+
node-version: "20"
20+
cache: "npm"
21+
22+
- name: Install dependencies
23+
run: npm install --legacy-peer-deps
24+
25+
- name: Check YAML format and sort
26+
run: npm run yaml:check
27+

.vscode/extensions.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
"recommendations": [
33
"JaimeOlivares.yuml",
44
"ms-azuretools.vscode-azurefunctions",
5-
"ms-azuretools.vscode-azurestaticwebapps"
5+
"ms-azuretools.vscode-azurestaticwebapps",
6+
"redhat.vscode-yaml",
7+
"PeterSchmalfeldt.vscode-yaml-sort"
68
]
79
}

.vscode/settings.json

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,18 @@
11
{
22
"sql-formatter.dialect": "n1ql",
3-
"sql-formatter.uppercase": true
3+
"sql-formatter.uppercase": true,
4+
5+
// YAML Sort extension (PeterSchmalfeldt.vscode-yaml-sort)
6+
// Sorts keys alphabetically and recursively — matches the app's formatYAML logic.
7+
"yaml-sort.sortOrder": "alphabetically",
8+
"yaml-sort.useLeadingDashes": false,
9+
"yaml-sort.indent": 2,
10+
"yaml-sort.forceQuotes": false,
11+
"yaml-sort.quotingType": "'",
12+
13+
// Format YAML files on save using the YAML Sort extension
14+
"[yaml]": {
15+
"editor.defaultFormatter": "PeterSchmalfeldt.vscode-yaml-sort",
16+
"editor.formatOnSave": true
17+
}
418
}

0 commit comments

Comments
 (0)