Skip to content

Commit a1b46c2

Browse files
Copilotantonmedv
andauthored
Fix deploy silently no-ops after zx 7→8 upgrade (#99) (#100)
Two breaking changes from the zx 7→8 upgrade caused this regression: 1. zx 8 defaults verbose to false (was true in zx 7), suppressing all command output from the Actions log. Fix: set $.verbose = true. 2. zx 8's quote("") returns $'' (explicit empty shell argument) instead of "" (which vanished in the command string). When the optional recipe input is empty, this passed an unwanted empty argument to Deployer, causing it to silently no-op. Fix: use arrays for optional args (recipe, verbosity) so empty values produce no arguments. Agent-Logs-Url: https://github.com/deployphp/action/sessions/9f7b96de-ce5c-4f32-baac-23aa7b69e161 Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: antonmedv <141232+antonmedv@users.noreply.github.com>
1 parent 9229ee2 commit a1b46c2

File tree

2 files changed

+20
-9
lines changed

2 files changed

+20
-9
lines changed

dist/index.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36631,6 +36631,7 @@ var import_build = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((expo
3663136631
var { VERSION, YAML, argv, dotenv, echo, expBackoff, fetch, fs, glob, globby, minimist, nothrow, parseArgv, question, quiet, retry, sleep, spinner, stdin, tempdir, tempfile, tmpdir, tmpfile, updateArgv, version, versions, $, Fail, ProcessOutput, ProcessPromise, bus, cd, chalk, defaults, kill, log, os: os$1, path, ps, quote, quotePowerShell, resolveDefaults, syncProcessCwd, useBash, usePowerShell, usePwsh, which, within } = globalThis.Deno ? globalThis.require("./index.cjs") : import_build;
3663236632
//#endregion
3663336633
//#region src/index.ts
36634+
$.verbose = true;
3663436635
(async function main() {
3663536636
try {
3663636637
await ssh();
@@ -36707,10 +36708,13 @@ async function dep() {
3670736708
bin = "deployer.phar";
3670836709
}
3670936710
const cmd = getInput("dep").split(" ");
36710-
let recipe = getInput("recipe");
36711-
if (recipe !== "") recipe = `--file=${recipe}`;
36711+
const recipeArgs = [];
36712+
const recipeInput = getInput("recipe");
36713+
if (recipeInput !== "") recipeArgs.push(`--file=${recipeInput}`);
3671236714
const ansi = getBooleanInput("ansi") ? "--ansi" : "--no-ansi";
36713-
const verbosity = getInput("verbosity");
36715+
const verbosityArgs = [];
36716+
const verbosityInput = getInput("verbosity");
36717+
if (verbosityInput !== "") verbosityArgs.push(verbosityInput);
3671436718
const options = [];
3671536719
try {
3671636720
const optionsArg = getInput("options");
@@ -36722,7 +36726,7 @@ async function dep() {
3672236726
const phpBinArg = getInput("php-binary");
3672336727
if (phpBinArg !== "") phpBin = phpBinArg;
3672436728
try {
36725-
await $`${phpBin} ${bin} ${cmd} ${recipe} --no-interaction ${ansi} ${verbosity} ${options}`;
36729+
await $`${phpBin} ${bin} ${cmd} ${recipeArgs} --no-interaction ${ansi} ${verbosityArgs} ${options}`;
3672636730
} catch (err) {
3672736731
setFailed(`Failed: dep ${cmd}`);
3672836732
}

src/index.ts

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import * as core from '@actions/core'
22
import { $, fs, cd } from 'zx'
33

4+
$.verbose = true
5+
46
interface ComposerLock {
57
packages?: Array<{ name: string; version: string }>
68
'packages-dev'?: Array<{ name: string; version: string }>
@@ -129,13 +131,18 @@ async function dep(): Promise<void> {
129131
}
130132

131133
const cmd = core.getInput('dep').split(' ')
132-
let recipe = core.getInput('recipe')
133-
if (recipe !== '') {
134-
recipe = `--file=${recipe}`
134+
const recipeArgs: string[] = []
135+
const recipeInput = core.getInput('recipe')
136+
if (recipeInput !== '') {
137+
recipeArgs.push(`--file=${recipeInput}`)
135138
}
136139

137140
const ansi = core.getBooleanInput('ansi') ? '--ansi' : '--no-ansi'
138-
const verbosity = core.getInput('verbosity')
141+
const verbosityArgs: string[] = []
142+
const verbosityInput = core.getInput('verbosity')
143+
if (verbosityInput !== '') {
144+
verbosityArgs.push(verbosityInput)
145+
}
139146
const options: string[] = []
140147
try {
141148
const optionsArg = core.getInput('options')
@@ -155,7 +162,7 @@ async function dep(): Promise<void> {
155162
}
156163

157164
try {
158-
await $`${phpBin} ${bin} ${cmd} ${recipe} --no-interaction ${ansi} ${verbosity} ${options}`
165+
await $`${phpBin} ${bin} ${cmd} ${recipeArgs} --no-interaction ${ansi} ${verbosityArgs} ${options}`
159166
} catch (err) {
160167
core.setFailed(`Failed: dep ${cmd}`)
161168
}

0 commit comments

Comments
 (0)