Commit b6854987 authored by paz's avatar paz

Merge branch '404-ci-changelog-check-parent-branch' into 'master'

CI: changelog job: check for parent branch, don't assume 'master'

Closes #404

See merge request !253
parents b571fc21 b1444860
Pipeline #22349 failed with stages
in 16 minutes and 59 seconds
......@@ -61,14 +61,15 @@ cache:
image: debian:unstable
APT_INSTALL_PACKAGES: ca-certificates git
APT_INSTALL_PACKAGES: ca-certificates git ruby
<<: *setup_prerequisites
# Ensure we work with the latest master
- git fetch origin master:master
# Compare the master and current branch using their common ancestors
- source <(./utils/ci/get-target-branch.rb)
# Ensure we work with the latest state
- git fetch origin $target_branch:$target_branch
# Compare the target and current branch using their common ancestors
# to check if the changelog was edited
- if git diff --exit-code --quiet master...HEAD --; then
- if git diff --exit-code --quiet $target_branch...HEAD --; then
echo "No CHANGELOG edit found, please verify manually";
exit 1;
#!/usr/bin/env ruby
# This script gets the target branch of a specific merge request. This
# is useful for example to check for a CHANGELOG edit.
# To enable the "export" of the env var to the parent (calling) shell,
# this script needs to be called in the following way:
# source <(./get-target-branch.rb)
require 'net/http'
require 'uri'
require 'json'
uri = URI.parse('')
response = Net::HTTP.get(uri)
json_data = JSON.parse(response)
if ! json_data.is_a?(Array)
puts json_data
exit 1
json_data.each do |merge_request|
if merge_request['sha'] == ENV['CI_COMMIT_SHA']
puts "export target_branch=#{merge_request['target_branch']}"
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment