Skip to content

Commit 36d86d4

Browse files
authored
Merge pull request #38 from veracode/SDEVX-8414
SDEVX-8414: Enable Platform-Specific Support for actions/artifact Versions (V3 for GHES, V4 for Cloud)
2 parents d87891a + 5696f24 commit 36d86d4

File tree

8 files changed

+5490
-2259
lines changed

8 files changed

+5490
-2259
lines changed

action.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ inputs:
5353
description: "Run the SRCCLR with the `--no-graphs` option"
5454
required: false
5555
default: "false"
56+
platformType:
57+
description: 'Specifies the platform environment type — use CLOUD for GitHub.com or ENTERPRISE for GitHub Enterprise Server (GHES).'
58+
default: 'CLOUD'
59+
required: false
5660
runs:
5761
using: 'node20'
5862
main: 'dist/index.js'

dist/index.js

Lines changed: 5428 additions & 2254 deletions
Large diffs are not rendered by default.

package-lock.json

Lines changed: 32 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
"typescript": "^4.5.5"
3232
},
3333
"dependencies": {
34+
"@actions/artifact-v1": "npm:@actions/artifact@^1.1.1",
3435
"@actions/artifact": "^2.1.4",
3536
"@actions/core": "^1.10.0",
3637
"@actions/github": "^5.0.0"

src/action.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ const options: Options = {
1818
"skip-vms": core.getBooleanInput('skip-vms'),
1919
"no-graphs": core.getBooleanInput('no-graphs'),
2020
recursive: core.getBooleanInput('recursive'),
21-
"skip-collectors": core.getInput('skip-collectors').split(',')
22-
21+
"skip-collectors": core.getInput('skip-collectors').split(','),
22+
platformType: core.getInput('platformType'),
2323
}
2424

2525
runAction(options);

src/options.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export interface Options {
1313
"skip-vms":boolean,
1414
"no-graphs":boolean,
1515
"skip-collectors": Array<string>
16+
platformType: string
1617
}
1718

1819

src/srcclr.ts

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,16 @@ export async function runAction (options: Options) {
118118
//store output files as artifacts
119119
core.info('Store json Results as Artifact')
120120
const { DefaultArtifactClient } = require('@actions/artifact');
121-
const artifactClient = new DefaultArtifactClient();
121+
const artifactV1 = require('@actions/artifact-v1');
122+
let artifactClient;
123+
124+
if (options?.platformType === 'ENTERPRISE') {
125+
artifactClient = artifactV1.create();
126+
core.info(`Initialized the artifact object using version V1.`);
127+
} else {
128+
artifactClient = new DefaultArtifactClient();
129+
core.info(`Initialized the artifact object using version V2.`);
130+
}
122131
const artifactName = 'Veracode Agent Based SCA Results';
123132
const files = [
124133
'scaResults.json'
@@ -188,7 +197,16 @@ export async function runAction (options: Options) {
188197
//store output files as artifacts
189198
core.info('Store txt Results as Artifact')
190199
const { DefaultArtifactClient } = require('@actions/artifact');
191-
const artifactClient = new DefaultArtifactClient();
200+
const artifactV1 = require('@actions/artifact-v1');
201+
let artifactClient;
202+
203+
if (options?.platformType === 'ENTERPRISE') {
204+
artifactClient = artifactV1.create();
205+
core.info(`Initialized the artifact object using version V1.`);
206+
} else {
207+
artifactClient = new DefaultArtifactClient();
208+
core.info(`Initialized the artifact object using version V2.`);
209+
}
192210
const artifactName = 'Veracode Agent Based SCA Results';
193211
const files = [
194212
'scaResults.txt'

src/test/testRun.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ const options: Options = {
1717
allowDirty: false,
1818
recursive:false,
1919
"skip-vms":false,
20-
"no-graphs":false
20+
"no-graphs":false,
21+
platformType:'CLOUD'
2122
}
2223

2324
runAction(options);

0 commit comments

Comments
 (0)