Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Empty output is not truly empty #3

Closed
T2L opened this issue Feb 8, 2022 · 2 comments · Fixed by #4
Closed

Empty output is not truly empty #3

T2L opened this issue Feb 8, 2022 · 2 comments · Fixed by #4

Comments

@T2L
Copy link
Contributor

T2L commented Feb 8, 2022

When there is no changes to the lock file, an empty composer_diff output is produced, but it's not truly empty.

See log of one oof my workflows:

##[debug]Evaluating: format('{0}
##[debug]', steps.composer_diff.outputs.composer_diff)
##[debug]Evaluating format:
##[debug]..Evaluating String:
##[debug]..=> '{0}
##[debug]'
##[debug]..Evaluating Index:
##[debug]....Evaluating Index:
##[debug]......Evaluating Index:
##[debug]........Evaluating steps:
##[debug]........=> Object
##[debug]........Evaluating String:
##[debug]........=> 'composer_diff'
##[debug]......=> Object
##[debug]......Evaluating String:
##[debug]......=> 'outputs'
##[debug]....=> Object
##[debug]....Evaluating String:
##[debug]....=> 'composer_diff'
##[debug]..=> ''
##[debug]=> '
##[debug]'
##[debug]Result: '
##[debug]'

then marocchino/sticky-pull-request-comment@v2 fails with Error: Either message or path input is required, but I cannot check if the output is an empty string like '' and skip the step, because it's not an empty string

@IonBazan IonBazan transferred this issue from IonBazan/composer-diff Feb 9, 2022
@IonBazan
Copy link
Owner

IonBazan commented Feb 9, 2022

@T2L thank you for the report. I've moved it to https://github.com/IonBazan/composer-diff-action because it is caused by the action itself and not the composer plugin. I will investigate this issue a bit more and I think it happened to me once too. Could you provide a repository where it actually happened?

@T2L
Copy link
Contributor Author

T2L commented Feb 9, 2022

it can be easily reproduced with this simple bash one-liner (make sure there are no update to the lock file, of course ) :

$ output=$(composer diff $*) && echo $output

You'll see that a newline is being printed. Calling a command directly does not produce one

Not sure what's the thing here, but it is related to how bash works ...

The easiest way of fixing is always call command with --strict parameter and then check if command result is 0, return an empty string ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants