Skip to content
Snippets Groups Projects

Iss #84 - Update git hook to enable fork validation

Merged Iss #84 - Update git hook to enable fork validation
1 unresolved thread
Merged Martin Lowe requested to merge (removed):malowe/master/84 into master
1 unresolved thread
1 file
+ 9
3
Compare changes
  • Side-by-side
  • Inline
+ 9
3
@@ -22,6 +22,9 @@ ALLOW_LIST_PROJECTS = ['/eclipse/oniro-core/meta-ts',
'/eclipse/oniro-core/meta-zephyr'
]
## Track whether forked project for error reporting (failing vs non-failing)
is_forked_project = false
## Process the commit into a hash object that will be posted to the ECA validation service
def process_commit(sha)
commit_parents_raw = `git show -s --format='%P' #{sha}`
@@ -94,8 +97,9 @@ if (nil_or_empty(project_json_data) || project_json_data.class.name == 'Array')
end
## Get the web URL, checking if project is a fork to get original project URL
if (!nil_or_empty(project_json_data['forked_from_project'])) then
puts "Non-Eclipse project repository detected: ECA validation will be skipped.\n\nNote that any issues with sign off or committer access will be flagged upon merging into the main project repository."
exit 0
puts "Fork detected, using forked from project's URL for better commit validation."
project_url = project_json_data['forked_from_project']['web_url']
is_forked_project = true
else
project_url = project_json_data['web_url']
end
@@ -209,6 +213,8 @@ else
end
end
## If error, exit as status 1
if (response.code == 403) then
if (response.code == 403 && is_forked_project) then
puts "Errors detected, but commits will be allowed for forked repository. Commit errors reported in this push will block merge into origin repository until resolved."
elsif (response.code == 403) then
exit 1
end
Loading