Skip to content

Commit 9857a68

Browse files
authored
Merge pull request #354 from sapcc/enterprise-artifact
Use older upload-artifact on GHE
2 parents c0fefea + fd3d47f commit 9857a68

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

internal/core/constants.go

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,19 @@ var DefaultGitHubEnterpriseRunsOn = map[string]string{
1616
}
1717
var SugarRunsOn = []string{"self-hosted"}
1818

19+
// GetUploadArtifactAction works around GitHub not supporting their own stuff
20+
// https://github.com/actions/upload-artifact/issues/537
21+
func GetUploadArtifactAction(isSelfHostedRunner bool) string {
22+
if isSelfHostedRunner {
23+
return "actions/upload-artifact@v2"
24+
} else {
25+
return "actions/upload-artifact@v4"
26+
}
27+
}
28+
1929
const (
20-
CheckoutAction = "actions/checkout@v5"
21-
SetupGoAction = "actions/setup-go@v5"
22-
UploadArtifactAction = "actions/upload-artifact@v4"
30+
CheckoutAction = "actions/checkout@v5"
31+
SetupGoAction = "actions/setup-go@v5"
2332

2433
DockerLoginAction = "docker/login-action@v3"
2534
DockerMetadataAction = "docker/metadata-action@v5"

internal/ghworkflow/workflow_ci.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ func ciWorkflow(cfg core.Configuration, sr golang.ScanResult) {
5757
coverageArtifactName := "code-coverage"
5858
testJob.addStep(jobStep{
5959
Name: "Archive code coverage results",
60-
Uses: core.UploadArtifactAction,
60+
Uses: core.GetUploadArtifactAction(ghwCfg.IsSelfHostedRunner),
6161
With: map[string]any{
6262
"name": coverageArtifactName,
6363
"path": "build/cover.out",

0 commit comments

Comments
 (0)