actions / upload-artifact

MIT License
3.26k stars 739 forks source link

correctly escaping multiple patterns when reading path from GITHUB_OUTPUT #394

Open francesco-ballarin opened 1 year ago

francesco-ballarin commented 1 year ago

What happened?

Hi, what is the correct way to escape a new line when multiple patterns are read from the output of a previous step

I have tried two different options at https://github.com/francesco-ballarin/test-artifacts-multiple/blob/main/.github/workflows/ci.yml

The first option is using \\n as separator. After #375, thanks to https://github.com/actions/upload-artifact/blob/main/dist/index.js#L2280 I was expecting this to work, but I get

Warning: No files were found with the provided path: *.txt\n*.dat. No artifacts will be uploaded.

(notice that using \n would not work, as it would insert a new line in the echo ... >> ${GITHUB_OUTPUT} call)

The second option is using %0A as separator. Before #375, I was quite sure that using %0A used to work (see e.g. https://trstringer.com/github-actions-multiline-strings/). After #375, I am quite confindent it will not work anymore, because https://github.com/actions/upload-artifact/blob/main/dist/index.js#L2278 escapes the % in %0A. Due to this, I get

Warning: No files were found with the provided path: .txt%0A*.dat. No artifacts will be uploaded.

Can you comment on what is the correct way to use multiple patterns coming from GITHUB_OUTPUT in the v3 version of this action?

Thanks!

What did you expect to happen?

Being able to read multiple patterns from the output of a previous step

How can we reproduce it?

https://github.com/francesco-ballarin/test-artifacts-multiple/blob/main/.github/workflows/ci.yml

Anything else we need to know?

No response

What version of the action are you using?

v3

What are your runner environments?

linux

Are you on GitHub Enterprise Server? If so, what version?

No response