Update tests + cleanup

This commit is contained in:
Konrad Pabjan
2023-10-30 14:58:12 -04:00
parent d45e4be1a6
commit fa898e325d
9 changed files with 247 additions and 633 deletions

View File

@@ -2,7 +2,12 @@ const core = require('@actions/core')
// All variables we need from the runtime are loaded here
const getContext = require('./context')
const { getArtifactMetadata, getPagesDeploymentStatus, createPagesDeployment, cancelPagesDeployment } = require('./api-client')
const {
getArtifactMetadata,
getPagesDeploymentStatus,
createPagesDeployment,
cancelPagesDeployment
} = require('./api-client')
const temporaryErrorStatus = {
unknown_status: 'Unable to get deployment status.',
@@ -58,15 +63,12 @@ class Deployment {
core.debug(`Action ID: ${this.actionsId}`)
core.debug(`Actions Workflow Run ID: ${this.workflowRun}`)
core.info("Getting artifact's metadata...")
const artifactData = await getArtifactMetadata({
githubToken: this.githubToken,
runId: this.workflowRun,
artifactName: this.artifactName
})
console.log(artifactData)
if (artifactData?.size > ONE_GIGABYTE) {
core.warning(
`Uploaded artifact size of ${artifactData?.size} bytes exceeds the allowed size of ${SIZE_LIMIT_DESCRIPTION}. Deployment might fail.`
@@ -241,4 +243,4 @@ class Deployment {
}
}
module.exports = { Deployment, MAX_TIMEOUT, ONE_GIGABYTE, SIZE_LIMIT_DESCRIPTION }
module.exports = { Deployment, MAX_TIMEOUT, ONE_GIGABYTE, SIZE_LIMIT_DESCRIPTION }