tcnksm / ghr

Upload multiple artifacts to GitHub Release in parallel
http://tcnksm.github.io/ghr/
MIT License
1.23k stars 80 forks source link

Invalid argument: you must set TAG and PATH name. #122

Open dominikbraun opened 4 years ago

dominikbraun commented 4 years ago

Hi,

in my CI, I'm running

ghr -t ${GITHUB_TOKEN} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} v0.1.9 artifacts/

to create my GH release using artifacts from the artifacts directory. Unfortunately, the following error occurs:

Invalid argument: you must set TAG and PATH name.

Any ideas?

drazisil commented 4 years ago

I think it should be:

ghr -t $GITHUB_TOKEN -u $CIRCLE_PROJECT_USERNAME -r $CIRCLE_PROJECT_REPONAME -c $CIRCLE_SHA1 v0.1.9 artifacts/
dominikbraun commented 4 years ago

Unfortunately, that doesn't work:

image

drazisil commented 4 years ago

This wording was changed in https://github.com/tcnksm/ghr/commit/18e905231419757c57559f9d0901d6657700c3cb, it's possible this issue was fixed as well. Are you on the latest version?

dominikbraun commented 4 years ago

Seems like this is not the latest version. I'm currently using the CircleCI image cibuilds/github:0.10 which comes with ghr... I'll try to download and run ghr manually.

dominikbraun commented 4 years ago

So now I get the new error message, but the error itself remains.

Invalid number of arguments: you must set a git TAG and optionally a PATH.
drazisil commented 4 years ago

I think i might see the issue in the code, but I'm not part of the team. Once i get a chance to try this I'll see if i get the same error.

dominikbraun commented 4 years ago

What piece of code do you have in mind?

drazisil commented 4 years ago

Line 70 of cli.go. i think its counting your flagged params, (token, etc.) In the count. The code appears to fail now if its not exactly 1 or 2 params, the way im looking at it

engineerakki commented 4 years ago

I am also facing the same issue. Did anyone find a fix ?

dominikbraun commented 4 years ago

Yes: The error occured because one of the flags (i.e. one of the environment variables) was empty, and ghr thought the path argument would be missing... yes, pretty weird.

I could fix the error by quoting the environment variables:

ghr -t "${GITHUB_TOKEN}" \
      -u "${CIRCLE_PROJECT_USERNAME}" \
      -r "${CIRCLE_PROJECT_REPONAME}" \
      -c "${CIRCLE_SHA1}" \
      v0.1.9 artifacts/

That showed me that I provided an empty value for a certain flag, which I fixed then.

antony-jr commented 1 year ago

This also happens if you give wildcard for the path field.. That is /output/* will not be recognized, it should be /output/ simply. This annoyed me a lot to be honest.

jubr commented 1 year ago

Ran into this as well, it looks like CIRCLE_PROJECT_REPONAME is not defined in some cases? Perhaps this happens with a free CircleCI instance?

@dominikbraun can you close this issue? Since the problem was not on the ghr side.

daniel-brenot commented 1 month ago

Just adding here that this happened to me when I didn't have my github token available to the cli. The error message isn't great and this would possibly benefit from better error messages