gitlab-org--gitlab-foss/scripts/lint-changelog-yaml
Sean McGivern e73c9ddc9e Extend changelog checker to test file extensions
Changelogs without a .yml extension won't be picked up, and will be ignored
completely, so fail the pipeline when one of those is found.
2017-09-29 15:24:16 +01:00

22 lines
436 B
Ruby
Executable file

#!/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