summaryrefslogtreecommitdiff
path: root/scripts/lint-changelog-yaml
blob: 06d502c46765a0d38d9e762bf3a254527952e666 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/env ruby

require 'yaml'

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

  begin
    YAML.load_file(changelog)
  rescue => exception
    puts exception
  end
end

if invalid_changelogs.any?
  puts
  puts "Invalid changelogs found!\n"
  puts invalid_changelogs.sort
  exit 1
else
  puts "All changelogs are valid YAML.\n"
  exit 0
end