From b14d330ff40cfe3956956a5f638c21a478473d9a Mon Sep 17 00:00:00 2001 From: Martin Lowe <martin.lowe@eclipse-foundation.org> Date: Thu, 14 Apr 2022 11:25:44 -0400 Subject: [PATCH] Add logic to skip project wikis --- src/main/rb/eca.rb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main/rb/eca.rb b/src/main/rb/eca.rb index 8685f216..4435f1ae 100644 --- a/src/main/rb/eca.rb +++ b/src/main/rb/eca.rb @@ -4,6 +4,7 @@ require 'json' require 'httparty' require 'multi_json' +WIKI_REGEX_MATCH = /.*\.wiki$/ ## Process the commit into a hash object that will be posted to the ECA validation service def process_commit(sha) @@ -48,6 +49,13 @@ new_head_commit = stdin_args[1] ## Get the project ID from env var, extracting from pattern 'project-###' project_id = ENV['GL_REPOSITORY'][8..-1] +project_path = ENV['GL_PROJECT_PATH'] +## Check if current repo is a project wiki (no project ID and ends in .wiki) +if (project_id.nil? && project_path =~ WIKI_REGEX_MATCH) then + puts "Repository is a project wiki and not bound by ECA, skipping" + exit 0 +end + ## Get data about project from API project_response = HTTParty.get("https://gitlab.eclipse.org/api/v4/projects/#{project_id}", :headers => { -- GitLab