From fdf18dcf43a42d99ab8ad5ff2e32fd2497fa36b6 Mon Sep 17 00:00:00 2001 From: iris <60985521+KaiAF@users.noreply.github.com> Date: Sun, 7 Jul 2024 19:24:06 -0500 Subject: [PATCH] fix github worker again --- .github/workflows/main.yml | 7 ------- dish/index.js | 19 +++++++++---------- 2 files changed, 9 insertions(+), 17 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a6254dc..21a27cc 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -32,12 +32,5 @@ jobs: git submodule update --init --recursive - name: Create dish workspace & patch run: node ./dish/index.js - - name: "Clone Bundler" - uses: actions/checkout@v3 - with: - token: ${{ secrets.PAT }} - repository: KaiAF/Dish-Bundler - path: Dish-Bundler - ref: main - name: Compile dish run: node ./dish/compile.js \ No newline at end of file diff --git a/dish/index.js b/dish/index.js index cb4c2da..e68a448 100644 --- a/dish/index.js +++ b/dish/index.js @@ -47,16 +47,7 @@ function parseLibraries(libraries) { // If workspace does not exist, try to create it. // If it fails, error out warn(`Workspace for version '${DECOMPILE_VERSION.split('/')[1]}' wasn't found. Running init.js in 5 seconds...`); - setTimeout(() => { - try { - execSync(`node init.js --MC="${DECOMPILE_VERSION}" --OLD_MC="${args[1] || ''}" --IGNORE-CACHE="${args[2] ? 'true' : 'false'}"`, { stdio }); - execSync(`node dish/index.js ${DECOMPILE_VERSION}${args[1] ? ' ' + args[1] : ''}`, { stdio }); - } catch (e) { - error(e); - return process.exit(1); - } - }, 1000 * 5); - return; + await generateWorkspace(); } if (!fs.existsSync(`dish/libraries/${DECOMPILE_VERSION.split('/')[1]}.json`)) { @@ -96,6 +87,14 @@ function parseLibraries(libraries) { process.exit(0); })(); +async function generateWorkspace() { + return new Promise((res, rej) => { + execSync(`node init.js --MC="${DECOMPILE_VERSION}" --OLD_MC="${args[1] || ''}" --IGNORE-CACHE="${args[2] ? 'true' : 'false'}"`, { stdio }); + execSync(`node dish/index.js ${DECOMPILE_VERSION}${args[1] ? ' ' + args[1] : ''}`, { stdio }); + res(); + }); +} + async function cacheServer(version = DECOMPILE_VERSION.split('/')[1]) { const manifestReq = await fetch('https://launchermeta.mojang.com/mc/game/version_manifest_v2.json'); if (manifestReq.status !== 200) {