diff --git a/.github/workflows/local.yml b/.github/workflows/local.yml index 3dada0c..0ad0717 100644 --- a/.github/workflows/local.yml +++ b/.github/workflows/local.yml @@ -1,4 +1,4 @@ -on: [push, pull_request] +on: [push, pull_request, workflow_dispatch] jobs: build: @@ -26,4 +26,14 @@ jobs: uses: ./ with: options: -screen 0 1600x1200x24 - run: xrandr \ No newline at end of file + run: xrandr + + - name: Test XVFB with multiple commands + if: ${{ matrix.os == 'ubuntu-latest' }} + uses: ./ + with: + options: -screen 0 1600x1200x24 + run: | + echo 'Testing xvfb' + pwd + xrandr diff --git a/index.js b/index.js index 940fb3e..1a37f3f 100644 --- a/index.js +++ b/index.js @@ -4,14 +4,21 @@ const exec = require('@actions/exec'); async function main() { try { - const command = core.getInput('run', { required: true }); + if (process.platform == "linux") { + await exec.exec("sudo apt-get install -y xvfb"); + } + + const commands = core.getInput('run', { required: true }).split("\n"); const directory = core.getInput('working-directory'); const serverOptions = core.getInput('options'); - if (process.platform == "linux") { - await runCommandWithXvfb(command, directory, serverOptions); - } else { - await runCommand(command, directory); + for (i in commands) { + if (process.platform == "linux") { + console.log('Command: ' + commands[i]); + await runCommandWithXvfb(commands[i], directory, serverOptions); + } else { + await runCommand(commands[i], directory); + } } } catch (error) { @@ -20,7 +27,6 @@ async function main() { } async function runCommandWithXvfb(command, directory, options) { - await exec.exec("sudo apt-get install -y xvfb"); const optionsArgument = options ? `-s "${options}"` : ''; command = `xvfb-run --auto-servernum ${optionsArgument} ${command}`;