Summary
The user is asking how to execute a command only when the --push
option is not present, specifically wanting to run a command with a dry-run flag like git push tags --dry-run
when --push
is omitted. They suggest using a pre-declared conditional statement and mention incorporating it within a RUN
command, providing a snippet that includes an ARG
for EARTHLY_PUSH
and a conditional check. They note that they were missing the ARG
declaration.
elliott.street
it was the ARG
declaration that I was missing
elliott.street
brilliant, thanks!
rrjjvv
In my snippet, I was using it within a RUN
, but you can use it to control RUN
itself:
IF [ "$EARTHLY_PUSH" = "true" ]
<snip>
END```
rrjjvv
You mean like this :slightly_smiling_face::
git push -u origin "$push_branch"; \
else \
echo "Will only push with --push!"; \
fi; \```
You just have to pre-declare it like other builtin args.
elliott.street
Is there a way to RUN
a command only when --push
is not provided?
e.g. If I omit push, I'd to run my command with the its dry-run flag instead, e.g. git push tags --dry-run