lint-changelog-yaml 475 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
  begin
    YAML.load_file(changelog)
11 12
  rescue => exception
    puts exception
13 14 15 16
  end
end

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