From e5215101d5d3a0878b60c8a4f6a8fccf3ef0ccf4 Mon Sep 17 00:00:00 2001 From: TheBrokenRail Date: Thu, 19 Oct 2023 19:17:01 -0400 Subject: [PATCH] More Fixes --- .github/workflows/process.yml | 2 +- src/common.ts | 5 ----- src/delete.ts | 5 ++--- src/index.ts | 8 ++++---- src/upload.ts | 5 ++--- 5 files changed, 9 insertions(+), 16 deletions(-) diff --git a/.github/workflows/process.yml b/.github/workflows/process.yml index f80d767..e42355b 100644 --- a/.github/workflows/process.yml +++ b/.github/workflows/process.yml @@ -6,7 +6,7 @@ on: - opened jobs: - publish: + process: runs-on: ubuntu-latest permissions: contents: write diff --git a/src/common.ts b/src/common.ts index 5135a94..a2ef51a 100644 --- a/src/common.ts +++ b/src/common.ts @@ -20,11 +20,6 @@ export function getPath() { return `${getFilename()}.png`; } -// Track Success -export const result = { - success: false -}; - // Connect export const octokit = new Octokit({ authStrategy: createActionAuth diff --git a/src/delete.ts b/src/delete.ts index f4e2a4c..2d68dd5 100644 --- a/src/delete.ts +++ b/src/delete.ts @@ -1,4 +1,4 @@ -import { getSha, getPath, octokit, REPO_OWNER, REPO_NAME, REPO_BRANCH, finish, result, event } from './common'; +import { getSha, getPath, octokit, REPO_OWNER, REPO_NAME, REPO_BRANCH, finish, event } from './common'; // Delete Skin export async function deleteSkin() { @@ -19,9 +19,8 @@ export async function deleteSkin() { // Success await finish('Skin successfully deleted!'); - result.success = true; } else { // Doesn't Exist - finish('Skin does not exist!'); + await finish('Skin does not exist!'); } } \ No newline at end of file diff --git a/src/index.ts b/src/index.ts index 0dc228a..3efbad5 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,4 +1,4 @@ -import { event, finish, result } from './common'; +import { event, finish } from './common'; import { deleteSkin } from './delete'; import { uploadSkin } from './upload'; @@ -30,8 +30,8 @@ import { uploadSkin } from './upload'; // Error await finish('An unexpected error has occurred!'); - } - // Exit - process.exit(result.success ? 0 : 1); + // Exit + process.exit(1); + } })(); \ No newline at end of file diff --git a/src/upload.ts b/src/upload.ts index b9f21ed..81a485c 100644 --- a/src/upload.ts +++ b/src/upload.ts @@ -1,4 +1,4 @@ -import { event, REPO_OWNER, REPO_NAME, REPO_BRANCH, getSha, getPath, octokit, finish, result, SKIN_WIDTH, SKIN_HEIGHT } from './common'; +import { event, REPO_OWNER, REPO_NAME, REPO_BRANCH, getSha, getPath, octokit, finish, SKIN_WIDTH, SKIN_HEIGHT } from './common'; import Jimp from 'jimp'; // Uplaod Skin @@ -19,7 +19,6 @@ async function uploadSkinFile(data: string) { // Success await finish('Skin successfully uploaded!'); - result.success = true; } // Handle Skin @@ -41,7 +40,7 @@ async function processSkin(imageUrl: string) { const image = await Jimp.read(buffer); if (image.getWidth() != SKIN_WIDTH || image.getHeight() != SKIN_HEIGHT) { // Incorrect Size - finish(`Skins must be ${SKIN_WIDTH}x${SKIN_HEIGHT} pixels!`); + await finish(`Skins must be ${SKIN_WIDTH}x${SKIN_HEIGHT} pixels!`); return; }