Commit b2f14359 authored by Peter Dave Hello's avatar Peter Dave Hello Committed by Lin Jen-Shin

Extend yamllint test to changelogs

cc !30979
parent b2e4a795
...@@ -62,7 +62,6 @@ docs lint: ...@@ -62,7 +62,6 @@ docs lint:
before_script: [] before_script: []
script: script:
- scripts/lint-doc.sh - scripts/lint-doc.sh
- scripts/lint-changelog-yaml
- mv doc/ /tmp/gitlab-docs/content/$DOCS_GITLAB_REPO_SUFFIX - mv doc/ /tmp/gitlab-docs/content/$DOCS_GITLAB_REPO_SUFFIX
- cd /tmp/gitlab-docs - cd /tmp/gitlab-docs
# Lint Markdown # Lint Markdown
......
...@@ -6,4 +6,4 @@ lint-ci-gitlab: ...@@ -6,4 +6,4 @@ lint-ci-gitlab:
dependencies: [] dependencies: []
image: sdesbure/yamllint:latest image: sdesbure/yamllint:latest
script: script:
- yamllint .gitlab-ci.yml .gitlab/ci lib/gitlab/ci/templates - yamllint .gitlab-ci.yml .gitlab/ci lib/gitlab/ci/templates changelogs
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
To generate and validate your changelog entries: To generate and validate your changelog entries:
1. Run `bin/changelog` to generate. 1. Run `bin/changelog` to generate.
1. Run `scripts/lint-changelog-yaml` to validate. 1. Run `yamllint changelogs` to validate.
See [development/changelog] documentation for detailed usage. See [development/changelog] documentation for detailed usage.
......
#!/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
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment