diff --git a/README.md b/README.md index cf4fdc6..3c1d061 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,7 @@ jobs: collapse-diff: false timezone: America/Los_Angeles timezone-locale: en-US + diff-tool: diff -N -u ``` diff --git a/action.yml b/action.yml index c673c2d..a835226 100644 --- a/action.yml +++ b/action.yml @@ -40,6 +40,10 @@ inputs: description: 'Time zone locale to use in comment' default: 'en-US' required: false + diff-tool: + description: 'Diff tool to use' + default: 'diff -N -u' + required: false runs: using: 'node12' main: 'dist/index.js' diff --git a/dist/index.js b/dist/index.js index 6062753..efcfedf 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1918,6 +1918,7 @@ const PLAINTEXT = core.getInput('plaintext').toLowerCase() === "true"; const COLLAPSE_DIFF = core.getInput('collapse-diff').toLowerCase() === "true"; const TIMEZONE = core.getInput('timezone'); const TIMEZONE_LOCALE = core.getInput('timezone-locale'); +const DIFF_TOOL = core.getInput('diff-tool') || 'diff -N -u'; let EXTRA_CLI_ARGS = core.getInput('argocd-extra-cli-args'); if (PLAINTEXT) { EXTRA_CLI_ARGS += ' --plaintext'; @@ -1957,7 +1958,7 @@ function setupArgoCDCommand() { fs.chmodSync(path.join(argoBinaryPath), '755'); // core.addPath(argoBinaryPath); return (params) => __awaiter(this, void 0, void 0, function* () { - return execCommand(`${argoBinaryPath} ${params} --auth-token=${ARGOCD_TOKEN} --server=${ARGOCD_SERVER_URL} ${EXTRA_CLI_ARGS}`); + return execCommand(`KUBECTL_EXTERNAL_DIFF='${DIFF_TOOL}' ${argoBinaryPath} ${params} --auth-token=${ARGOCD_TOKEN} --server=${ARGOCD_SERVER_URL} ${EXTRA_CLI_ARGS}`); }); }); } diff --git a/src/main.ts b/src/main.ts index 89a1e2c..59d3833 100644 --- a/src/main.ts +++ b/src/main.ts @@ -41,6 +41,7 @@ const PLAINTEXT = core.getInput('plaintext').toLowerCase() === "true"; const COLLAPSE_DIFF = core.getInput('collapse-diff').toLowerCase() === "true"; const TIMEZONE = core.getInput('timezone'); const TIMEZONE_LOCALE = core.getInput('timezone-locale'); +const DIFF_TOOL = core.getInput('diff-tool') || 'diff -N -u'; let EXTRA_CLI_ARGS = core.getInput('argocd-extra-cli-args'); if (PLAINTEXT) { EXTRA_CLI_ARGS += ' --plaintext'; @@ -87,7 +88,7 @@ async function setupArgoCDCommand(): Promise<(params: string) => Promise execCommand( - `${argoBinaryPath} ${params} --auth-token=${ARGOCD_TOKEN} --server=${ARGOCD_SERVER_URL} ${EXTRA_CLI_ARGS}` + `KUBECTL_EXTERNAL_DIFF='${DIFF_TOOL}' ${argoBinaryPath} ${params} --auth-token=${ARGOCD_TOKEN} --server=${ARGOCD_SERVER_URL} ${EXTRA_CLI_ARGS}` ); }