summaryrefslogtreecommitdiff
path: root/scripts/lint-changelog-yaml
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/lint-changelog-yaml')
-rwxr-xr-xscripts/lint-changelog-yaml22
1 files changed, 22 insertions, 0 deletions
diff --git a/scripts/lint-changelog-yaml b/scripts/lint-changelog-yaml
new file mode 100755
index 00000000000..cce5f1c7667
--- /dev/null
+++ b/scripts/lint-changelog-yaml
@@ -0,0 +1,22 @@
+#!/usr/bin/env ruby
+
+require 'yaml'
+
+invalid_changelogs = Dir['changelogs/**/*'].reject do |changelog|
+ next true if changelog =~ /(archive\.md|unreleased(-ee)?)$/
+ next false unless changelog.end_with?('.yml')
+
+ begin
+ YAML.load_file(changelog)
+ rescue
+ end
+end
+
+if invalid_changelogs.any?
+ puts "Invalid changelogs found!\n"
+ puts invalid_changelogs.sort
+ exit 1
+else
+ puts "All changelogs are valid YAML.\n"
+ exit 0
+end