@@ -24962,6 +24962,7 @@ function run() {
2496224962 const appId = core.getInput("app_id", { required: true });
2496324963 const containerName = core.getInput("container", { required: true });
2496424964 const imageTag = core.getInput("image_tag", { required: true });
24965+ const imageDigest = core.getInput("image_digest");
2496524966 try {
2496624967 const appConfig = yield getAppConfiguration(apiKey, appId);
2496724968 const containers = appConfig.containerTemplates.filter(v => v.name === containerName);
@@ -24972,8 +24973,13 @@ function run() {
2497224973 throw new Error(`Found more than one container named "${containerName}".`);
2497324974 }
2497424975 const containerId = containers[0].id;
24975- console.log(`Updating container "${containerName}" (${containerId}) with tag "${imageTag}"`);
24976- patchAppContainer(apiKey, appId, containerId, imageTag);
24976+ if (imageDigest === '') {
24977+ console.log(`Updating container "${containerName}" (${containerId}) with tag "${imageTag}"`);
24978+ }
24979+ else {
24980+ console.log(`Updating container "${containerName}" (${containerId}) with tag "${imageTag}", digest "${imageDigest}"`);
24981+ }
24982+ patchAppContainer(apiKey, appId, containerId, imageTag, imageDigest);
2497724983 }
2497824984 catch (e) {
2497924985 if (typeof e === 'string' || e instanceof Error) {
@@ -25020,19 +25026,23 @@ function getAppConfiguration(apiKey, appId) {
2502025026 });
2502125027 });
2502225028}
25023- function patchAppContainer(apiKey, appId, containerId, imageTag) {
25029+ function patchAppContainer(apiKey, appId, containerId, imageTag, imageDigest ) {
2502425030 return __awaiter(this, void 0, void 0, function* () {
25031+ const body = {
25032+ id: containerId,
25033+ imageTag: imageTag,
25034+ };
25035+ if (imageDigest !== undefined && imageDigest.length > 0) {
25036+ body.imageDigest = imageDigest;
25037+ }
2502525038 return new Promise((resolve, reject) => {
2502625039 fetch(`https://api.bunny.net/mc/apps/${appId}/containers/${containerId}`, {
2502725040 method: 'PATCH',
2502825041 headers: {
2502925042 'Content-Type': 'application/json',
2503025043 'AccessKey': apiKey,
2503125044 },
25032- body: JSON.stringify({
25033- id: containerId,
25034- imageTag: imageTag,
25035- }),
25045+ body: JSON.stringify(body),
2503625046 })
2503725047 .then(response => {
2503825048 if (response.status !== 200) {
0 commit comments