Skip to content

Commit

Permalink
More Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
TheBrokenRail committed Oct 19, 2023
1 parent afa8357 commit e521510
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/process.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- opened

jobs:
publish:
process:
runs-on: ubuntu-latest
permissions:
contents: write
Expand Down
5 changes: 0 additions & 5 deletions src/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 2 additions & 3 deletions src/delete.ts
Original file line number Diff line number Diff line change
@@ -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() {
Expand All @@ -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!');
}
}
8 changes: 4 additions & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { event, finish, result } from './common';
import { event, finish } from './common';
import { deleteSkin } from './delete';
import { uploadSkin } from './upload';

Expand Down Expand Up @@ -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);
}
})();
5 changes: 2 additions & 3 deletions src/upload.ts
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -19,7 +19,6 @@ async function uploadSkinFile(data: string) {

// Success
await finish('Skin successfully uploaded!');
result.success = true;
}

// Handle Skin
Expand All @@ -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;
}

Expand Down

0 comments on commit e521510

Please sign in to comment.