diff --git a/lib/xgo.js b/lib/xgo.js index c604a1d..49e3c17 100644 --- a/lib/xgo.js +++ b/lib/xgo.js @@ -26,8 +26,7 @@ const exec = __importStar(require("@actions/exec")); function run() { return __awaiter(this, void 0, void 0, function* () { try { - const repo = process.env['GITHUB_REPOSITORY']; - const root = path.join(__dirname, '..'); + const workspace = process.env['GITHUB_WORKSPACE'] || '.'; const xgo_version = '0.3.1'; const go_version = core.getInput('go_version'); const dest = core.getInput('dest'); @@ -64,12 +63,12 @@ function run() { if (ldflags) { args.push('-ldflags', ldflags); } - args.push(root); + args.push(workspace); yield exec.exec(xgo_path, args); console.log('🔨 Fixing perms...'); const uid = parseInt(child_process.execSync(`id -u`, { encoding: 'utf8' }).trim()); const gid = parseInt(child_process.execSync(`id -g`, { encoding: 'utf8' }).trim()); - yield exec.exec('sudo', ['chown', '-R', `${uid}:${gid}`, root]); + yield exec.exec('sudo', ['chown', '-R', `${uid}:${gid}`, workspace]); } catch (error) { core.setFailed(error.message); diff --git a/src/xgo.ts b/src/xgo.ts index 6c1ccdb..97f19c8 100644 --- a/src/xgo.ts +++ b/src/xgo.ts @@ -8,9 +8,7 @@ import * as exec from '@actions/exec'; async function run() { try { - const repo = process.env['GITHUB_REPOSITORY']; - const root = path.join(__dirname, '..'); - + const workspace = process.env['GITHUB_WORKSPACE'] || '.'; const xgo_version = '0.3.1'; const go_version = core.getInput('go_version'); const dest = core.getInput('dest'); @@ -53,7 +51,7 @@ async function run() { if (ldflags) { args.push('-ldflags', ldflags); } - args.push(root); + args.push(workspace); await exec.exec(xgo_path, args); console.log('🔨 Fixing perms...'); @@ -63,7 +61,7 @@ async function run() { const gid = parseInt( child_process.execSync(`id -g`, {encoding: 'utf8'}).trim() ); - await exec.exec('sudo', ['chown', '-R', `${uid}:${gid}`, root]); + await exec.exec('sudo', ['chown', '-R', `${uid}:${gid}`, workspace]); } catch (error) { core.setFailed(error.message); }