From c43905440514347d34c32dfd9058c3d9a33dd5e7 Mon Sep 17 00:00:00 2001 From: rickstaa Date: Thu, 10 Dec 2020 14:25:34 +0100 Subject: [PATCH] :bug: Fixes flake8 command piping problem Due to a bug in the @actions/exec package piping of commands is currently not supported. I therefore had to use the workarround that is given in https://github.com/actions/toolkit/issues/346. --- dist/index.js | 12 ++++++------ src/index.js | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/dist/index.js b/dist/index.js index d2533aa..72c3e54 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1619,11 +1619,11 @@ async function run() { await exec.exec("python -m pip install --upgrade pip"); } - // install reviewdog + // install Reviewdog (nightly) console.log(`[*] Installing reviewdog...`); await exec.exec( `/bin/bash -c "wget -O - -q https://raw.githubusercontent.com/reviewdog/nightly/master/install.sh| sudo sh -s -- -b /usr/local/bin/` - ); + ); // /bin/bash -c is needed since @actions/exec does not yet support piping https://github.com/actions/toolkit/issues/346 // install/update flake8 package console.log(`[*] Installing flake8 package @ ${flake8Version}...`); @@ -1674,13 +1674,13 @@ async function run() { level = "error"; } - // Add reviewdog execution code + // setup reviewdog execution command console.log(`[*] Adding reviewdog command...`); - flake8Cmd += `| reviewdog -f flake8 -name="flake8-lint" -reporter="${reporter}" -level="${level}" -tee`; + const reviewdogCmd = `reviewdog -f flake8 -name="flake8-lint" -reporter="${reporter}" -level="${level}" -tee`; - // execute flake8 + // execute flake8 with reviewdog annotations console.log(`[*] Executing flake8 + reviewdog command...`); - await exec.exec(`${flake8Cmd}`); + await exec.exec(`/bin/bash -c "${flake8Cmd}|${reviewdogCmd}"`); } catch (error) { core.setFailed( `ERROR: Action failed during execution with error: ${error.message}` diff --git a/src/index.js b/src/index.js index e5ad807..59a6930 100644 --- a/src/index.js +++ b/src/index.js @@ -24,11 +24,11 @@ async function run() { await exec.exec("python -m pip install --upgrade pip"); } - // install reviewdog + // install Reviewdog (nightly) console.log(`[*] Installing reviewdog...`); await exec.exec( `/bin/bash -c "wget -O - -q https://raw.githubusercontent.com/reviewdog/nightly/master/install.sh| sudo sh -s -- -b /usr/local/bin/` - ); + ); // /bin/bash -c is needed since @actions/exec does not yet support piping https://github.com/actions/toolkit/issues/346 // install/update flake8 package console.log(`[*] Installing flake8 package @ ${flake8Version}...`); @@ -79,13 +79,13 @@ async function run() { level = "error"; } - // Add reviewdog execution code + // setup reviewdog execution command console.log(`[*] Adding reviewdog command...`); - flake8Cmd += `| reviewdog -f flake8 -name="flake8-lint" -reporter="${reporter}" -level="${level}" -tee`; + const reviewdogCmd = `reviewdog -f flake8 -name="flake8-lint" -reporter="${reporter}" -level="${level}" -tee`; - // execute flake8 + // execute flake8 with reviewdog annotations console.log(`[*] Executing flake8 + reviewdog command...`); - await exec.exec(`${flake8Cmd}`); + await exec.exec(`/bin/bash -c "${flake8Cmd}|${reviewdogCmd}"`); } catch (error) { core.setFailed( `ERROR: Action failed during execution with error: ${error.message}`