mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-01-04 19:29:49 -06:00
this fixes the custom clone step for forks with outdated default branch
This commit is contained in:
17
.drone.star
17
.drone.star
@@ -357,7 +357,12 @@ def uploadScanResults(ctx):
|
||||
"SONAR_PULL_REQUEST_KEY": "%s" % (ctx.build.ref.replace("refs/pull/", "").split("/")[0]),
|
||||
})
|
||||
|
||||
repo_slug = ctx.build.source_repo if ctx.build.source_repo else ctx.repo.slug
|
||||
fork_handling = []
|
||||
if ctx.build.source_repo:
|
||||
fork_handling = [
|
||||
"git remote add fork https://github.com/%s.git" % (ctx.build.source_repo),
|
||||
"git pull fork",
|
||||
]
|
||||
|
||||
return {
|
||||
"kind": "pipeline",
|
||||
@@ -375,9 +380,13 @@ def uploadScanResults(ctx):
|
||||
"name": "clone",
|
||||
"image": "alpine/git:latest",
|
||||
"commands": [
|
||||
"git clone https://github.com/%s.git ." % (repo_slug),
|
||||
"git checkout $DRONE_COMMIT",
|
||||
],
|
||||
# Always use the owncloud/ocis repository as base to have an up to date default branch.
|
||||
# This is needed for the skipIfUnchanged step, since it references a commit on master (which could be absent on a fork)
|
||||
"git clone https://github.com/%s.git ." % (ctx.repo.slug),
|
||||
] + fork_handling +
|
||||
[
|
||||
"git checkout $DRONE_COMMIT",
|
||||
],
|
||||
},
|
||||
] + skipIfUnchanged(ctx, "unit-tests") + [
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user