add inputs used by autosubmission
This commit is contained in:
24
action.yml
24
action.yml
@@ -17,6 +17,30 @@ inputs:
|
||||
required: true
|
||||
description: 'Build target to detect build dependencies. If unspecified, will use "all", with will detect all dependencies used in all build targets (including tests and tools).'
|
||||
default: 'all'
|
||||
snapshot-sha:
|
||||
description: The SHA that the results will be linked to in the dependency snapshot
|
||||
type: string
|
||||
required: false
|
||||
default: ''
|
||||
snapshot-ref:
|
||||
description: The ref that the results will be linked to in the dependency snapshot
|
||||
type: string
|
||||
required: false
|
||||
default: ''
|
||||
|
||||
# If any of detector-name, detector-version, or detector-url are provided, they all have to be provided. Defaults will be used if any are not provided.
|
||||
detector-name:
|
||||
description: The name of the detector that generated the dependency snapshot
|
||||
type: string
|
||||
required: false
|
||||
detector-version:
|
||||
description: The version of the detector that generated the dependency snapshot
|
||||
type: string
|
||||
required: false
|
||||
detector-url:
|
||||
description: The URL to the detector that generated the dependency snapshot
|
||||
type: string
|
||||
required: false
|
||||
runs:
|
||||
using: 'node20'
|
||||
main: 'dist/index.js'
|
||||
|
||||
29
src/index.ts
29
src/index.ts
@@ -77,12 +77,32 @@ async function main () {
|
||||
manifest.addIndirectDependency(dep)
|
||||
})
|
||||
|
||||
const snapshot = new Snapshot(
|
||||
{
|
||||
type SnapshotDetector = {
|
||||
name: string;
|
||||
url: string;
|
||||
version: string;
|
||||
};
|
||||
var snapshotDetector: SnapshotDetector;
|
||||
|
||||
// If detector name is passed in, then url and version are required inputs
|
||||
// Otherwise, default values will be used to maintain backwards compatibility
|
||||
const detectorName = core.getInput('detector-name');
|
||||
if (detectorName !== '') {
|
||||
snapshotDetector = {
|
||||
name: detectorName,
|
||||
url: core.getInput('detector-url', { required: true }),
|
||||
version: core.getInput('detector-version', { required: true })
|
||||
}
|
||||
} else {
|
||||
snapshotDetector = {
|
||||
name: 'actions/go-dependency-submission',
|
||||
url: 'https://github.com/actions/go-dependency-submission',
|
||||
version: '0.0.1'
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
const snapshot = new Snapshot(
|
||||
snapshotDetector,
|
||||
github.context,
|
||||
{
|
||||
correlator: `${github.context.job}-${goBuildTarget}`,
|
||||
@@ -90,6 +110,9 @@ async function main () {
|
||||
}
|
||||
)
|
||||
snapshot.addManifest(manifest)
|
||||
snapshot.sha = core.getInput('snapshot-sha')
|
||||
snapshot.ref = core.getInput('snapshot-ref')
|
||||
|
||||
submitSnapshot(snapshot)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user