Input to set detector information
This commit is contained in:
+9
-1
@@ -18,6 +18,14 @@ async function run() {
|
||||
sha: core.getInput('snapshot-sha'),
|
||||
ref: core.getInput('snapshot-ref'),
|
||||
}
|
||||
const detectorName = core.getInput('detector-name');
|
||||
if (detectorName !== '') {
|
||||
snapshotConfig.detector = {
|
||||
name: detectorName,
|
||||
url: core.getInput('detector-url', { required: true }),
|
||||
version: core.getInput('detector-version', { required: true }),
|
||||
};
|
||||
}
|
||||
|
||||
snapshot = await generateSnapshot(directory, mavenConfig, snapshotConfig);
|
||||
} catch (err: any) {
|
||||
@@ -36,4 +44,4 @@ async function run() {
|
||||
}
|
||||
}
|
||||
|
||||
run();
|
||||
run();
|
||||
|
||||
@@ -22,6 +22,11 @@ export type SnapshotConfig = {
|
||||
job?: any;
|
||||
sha?: any;
|
||||
ref?: any;
|
||||
detector?: {
|
||||
name: string;
|
||||
url: string;
|
||||
version: string;
|
||||
};
|
||||
};
|
||||
|
||||
export async function generateSnapshot(directory: string, mvnConfig?: MavenConfiguration, snapshotConfig?: SnapshotConfig) {
|
||||
@@ -44,7 +49,8 @@ export async function generateSnapshot(directory: string, mvnConfig?: MavenConfi
|
||||
manifest = mavenDependencies.createManifest();
|
||||
}
|
||||
|
||||
const snapshot = new Snapshot(getDetector(), snapshotConfig?.context, snapshotConfig?.job);
|
||||
const detector = snapshotConfig?.detector ?? getDetector();
|
||||
const snapshot = new Snapshot(detector, snapshotConfig?.context, snapshotConfig?.job);
|
||||
snapshot.addManifest(manifest);
|
||||
|
||||
const specifiedRef = getNonEmtptyValue(snapshotConfig?.ref);
|
||||
@@ -170,4 +176,4 @@ function getNonEmtptyValue(str?: string) {
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user