BigW Consortium Gitlab

lint-changelog-yaml 436 Bytes
Newer Older
1 2 3 4
#!/usr/bin/env ruby

require 'yaml'

5 6 7 8
invalid_changelogs = Dir['changelogs/**/*'].reject do |changelog|
  next true if changelog =~ /(archive\.md|unreleased(-ee)?)$/
  next false unless changelog.end_with?('.yml')

9 10 11 12 13 14 15
  begin
    YAML.load_file(changelog)
  rescue
  end
end

if invalid_changelogs.any?
16
  puts "Invalid changelogs found!\n"
17 18 19 20 21 22
  puts invalid_changelogs.sort
  exit 1
else
  puts "All changelogs are valid YAML.\n"
  exit 0
end