Skip to content

Commit

Permalink
main: cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
dawidd6 committed Aug 30, 2022
1 parent 72c8fa9 commit 7847792
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions main.js
Expand Up @@ -5,10 +5,6 @@ const filesize = require('filesize')
const pathname = require('path')
const fs = require('fs')

function inform(key, val) {
core.info(`==> ${key}: ${val}`)
}

async function main() {
try {
const token = core.getInput("github_token", { required: true })
Expand Down Expand Up @@ -141,8 +137,7 @@ async function main() {
}

if (!runID) {
setExitMessage(ifNoArtifactFound, "no matching workflow run found with any artifacts?")
return
return setExitMessage(ifNoArtifactFound, "no matching workflow run found with any artifacts?")
}

let artifacts = await client.paginate(client.rest.actions.listWorkflowRunArtifacts, {
Expand Down Expand Up @@ -187,13 +182,12 @@ async function main() {
}

if (artifacts.length == 0) {
setExitMessage(ifNoArtifactFound, "no artifacts found")
return
return setExitMessage(ifNoArtifactFound, "no artifacts found")
}

core.setOutput("found_artifact", true)

for (const artifact of artifacts) {

core.info(`==> Artifact: ${artifact.id}`)

const size = filesize(artifact.size_in_bytes, { base: 10 })
Expand Down Expand Up @@ -238,6 +232,7 @@ async function main() {

function setExitMessage(ifNoArtifactFound, message) {
core.setOutput("found_artifact", false)

switch (ifNoArtifactFound) {
case "fail":
core.setFailed(message)
Expand Down

0 comments on commit 7847792

Please sign in to comment.