Skip to content

Commit

Permalink
fix(*): revert formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
LonghronShen committed Dec 23, 2022
1 parent 6149368 commit 3231f89
Showing 1 changed file with 12 additions and 25 deletions.
37 changes: 12 additions & 25 deletions src/run-on-arch.js
Original file line number Diff line number Diff line change
@@ -1,32 +1,24 @@
/*jshint esversion: 9 */

const core = require('@actions/core')
const core = require('@actions/core');
const fs = require('fs');
const path = require('path')
const path = require('path');
const YAML = require('yaml');
const shlex = require('shlex');
const {
exec
} = require('@actions/exec')
const { exec } = require('@actions/exec');

function slug(str) {
return str.replace(/[^a-zA-Z0-9]/g, '-').toLowerCase();
}

async function main() {
if (process.platform !== 'linux') {
throw new Error('run-on-arch supports only Linux')
throw new Error('run-on-arch supports only Linux');
}

const arch = core.getInput('arch', {
required: true
});
const distro = core.getInput('distro', {
required: true
});
const base_image = core.getInput('base_image', {
required: false
});
const arch = core.getInput('arch', { required: true });
const distro = core.getInput('distro', { required: true });
const base_image = core.getInput('base_image', { required: false });

// If bad arch/distro passed, fail fast before installing all the qemu stuff
const dockerFile = path.join(
Expand Down Expand Up @@ -83,9 +75,7 @@ async function main() {

// Write container commands to a script file for running
const commands = [
`#!${shell}`, 'set -eu;', core.getInput('run', {
required: true
}),
`#!${shell}`, 'set -eu;', core.getInput('run', { required: true }),
].join('\n');
fs.writeFileSync(
path.join(__dirname, 'run-on-arch-commands.sh'),
Expand All @@ -98,9 +88,7 @@ async function main() {
const githubToken = core.getInput('githubToken');

// Copy environment variables from parent process
const env = {
...process.env
};
const env = { ...process.env };

if (githubToken) {
env.GITHUB_TOKEN = githubToken;
Expand Down Expand Up @@ -134,12 +122,11 @@ async function main() {
console.log('Configuring Docker for multi-architecture support');
await exec(
path.join(__dirname, 'run-on-arch.sh'),
[dockerFile, containerName, ...dockerRunArgs], {
env
},
[ dockerFile, containerName, ...dockerRunArgs ],
{ env },
);
}

main().catch(err => {
core.setFailed(err.message);
});
});

0 comments on commit 3231f89

Please sign in to comment.