add inputs used by autosubmission

This commit is contained in:
E. Lynette Rayle
2025-05-27 22:02:13 +00:00
parent f35d5c9af1
commit f3f97c6024
2 changed files with 50 additions and 3 deletions

View File

@@ -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)
}