mirror of
https://github.com/WebBreacher/WhatsMyName.git
synced 2025-06-18 14:25:31 -04:00
Skip write if data is already sorted
This commit is contained in:
parent
01adc69738
commit
7f0ff9ea26
12
.github/workflows/sort-format-json.yml
vendored
12
.github/workflows/sort-format-json.yml
vendored
@ -64,8 +64,16 @@ jobs:
|
||||
data.sites = data.sites.map(site => reorderObjectKeys(site, keyOrder));
|
||||
}
|
||||
|
||||
fs.writeFileSync(dataPath, JSON.stringify(data, null, 2));
|
||||
console.log('wmn-data.json sorted and reordered according to schema');
|
||||
// Convert to JSON with 2-space indentation
|
||||
const updated = JSON.stringify(data, null, 2);
|
||||
|
||||
// Only write if content has changed
|
||||
if (original !== updated) {
|
||||
fs.writeFileSync(dataPath, updated);
|
||||
console.log('wmn-data.json updated and reordered.');
|
||||
} else {
|
||||
console.log('wmn-data.json is already sorted and formatted.');
|
||||
}
|
||||
EOF
|
||||
|
||||
- name: Install Prettier
|
||||
|
Loading…
Reference in New Issue
Block a user