downcase subject name for OCI images (#63)

Signed-off-by: Brian DeHamer <[email protected]>
This commit is contained in:
Brian DeHamer
2024-05-14 08:11:10 -07:00
committed by GitHub
parent 60d0be1445
commit 38ff958ab6
3 changed files with 47 additions and 8 deletions
Generated Vendored
+8 -2
View File
@@ -80186,6 +80186,9 @@ const subjectFromInputs = async () => {
const subjectPath = core.getInput('subject-path', { required: false });
const subjectDigest = core.getInput('subject-digest', { required: false });
const subjectName = core.getInput('subject-name', { required: false });
const pushToRegistry = core.getBooleanInput('push-to-registry', {
required: false
});
if (!subjectPath && !subjectDigest) {
throw new Error('One of subject-path or subject-digest must be provided');
}
@@ -80195,11 +80198,14 @@ const subjectFromInputs = async () => {
if (subjectDigest && !subjectName) {
throw new Error('subject-name must be provided when using subject-digest');
}
// If push-to-registry is enabled, ensure the subject name is lowercase
// to conform to OCI image naming conventions
const name = pushToRegistry ? subjectName.toLowerCase() : subjectName;
if (subjectPath) {
return await getSubjectFromPath(subjectPath, subjectName);
return await getSubjectFromPath(subjectPath, name);
}
else {
return [getSubjectFromDigest(subjectDigest, subjectName)];
return [getSubjectFromDigest(subjectDigest, name)];
}
};
exports.subjectFromInputs = subjectFromInputs;