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

Fix GH API path to include GH user #3

Closed
wants to merge 1 commit into from
Closed

Conversation

ndeet
Copy link

@ndeet ndeet commented Nov 18, 2019

The API call seems to miss the GH user and returns always null for me when running in terminal. ${SLUG} only contains lowercased repo name, which might also fail?

Note: I have no idea what that :- does in line 34 + 35, can you enlighten me?

For the API call on GH it should use the original GH user + repo name otherwise the to lowercased values (for DockerHub) will fail in this case? If I'm wrong I will replace the values with $USER and $SLUG

Maybe this fixes #2 also. I had description: true and actually a description on my repo but it failed.

The API call seems to miss the GH user and returns always `null` for me when running in terminal. 

Note: I have no idea what that `:-` does in line 34 + 35, can you enlighten me? 

For the API call on GH it should use the original GH user + repo name otherwise the to lowercased values (for DockerHub) will fail in this case? 

Maybe this fixes meeDamian#2 also. I had `description: true` and actually a description on my repo but it failed.
@meeDamian
Copy link
Owner

I'm sorry, I'm not quite sure what the problem here is, but perhaps some of the below can help(?):

only contains lowercased repo name, which might also fail?

All repos on Docker Hub MUST be lowercase.

Note: I have no idea what that :- does in line 34 + 35, can you enlighten me?

It's a fallback. If INPUT_* is empty (AKA. values for slug:, and user: were not set here), an attempt is made to get them from GITHUB_* context instead.

In your case, the slug being used is determined to be this: https://github.com/ndeet/docker-electrumx-workflow/runs/309480084#step:18:10, given you don't use docker- prefix on Docker Hub, consider overriding it with: slug: ndeet/electrumx-workflow

lmk if that helps.

@meeDamian
Copy link
Owner

Also, your proposed change here would result in a URL like this:

https://api.github.com/repos/ndeet/ndeet/docker-electrumx-workflow
                             ^^^^^ 
                     GITHUB_ACTOR  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
									      GITHUB_REPOSITORY

@ndeet
Copy link
Author

ndeet commented Nov 19, 2019

Hi, thank you for the explanations. I think my main issue was with the slug, which I fixed by explicitly writing it down like you suggested but the description: true fails still to fetch the repo description.

only contains lowercased repo name, which might also fail?
All repos on Docker Hub MUST be lowercase.

In this case (line 66) we query the GH api and not docker. But I also tested to query GH api with mixed case and lowercase and both work, so the GH api seems to internally lowercase the request anyway.

➜  docker-electrumx git:(master) curl -s "https://api.github.com/repos/octocat/Hello-World" | jq '.description'
"My first repository on GitHub!"
➜  docker-electrumx git:(master) curl -s "https://api.github.com/repos/octocat/hello-world" | jq '.description'
"My first repository on GitHub!"

Ok, so $GITHUB_ACTOR has the owner included, that was a wrong assumption from me then. Sorry first time I interact with docker builds and GH actions.
Is there any easy way to test workflows? It is a bit cumbersome to always do a commit to see it fail on the last step after running 5 minutes. Or a way to debug env variables in the workflow? e.g. console_log() it :D

@ndeet
Copy link
Author

ndeet commented Nov 19, 2019

Closing this as it duplicates the repo owner and is wrong. Would appreciate if you have any tools/suggestions to easier debug workflows.

@ndeet ndeet closed this Nov 19, 2019
@ndeet ndeet deleted the patch-1 branch November 19, 2019 22:19
@meeDamian
Copy link
Owner

In this case (line 66) we query the GH api and not docker.

Of course 🤦🏻‍♂️. It's a bug, and the ${SLUG} there should be changed to ${GITHUB_REPOSITORY}.

GH Actions are still in very active development. Things change all the time, and there's a bunch of odd behaviours (secrets not working in forks 🤷🏻‍♂️), so while I vaguely remember someone creating a way to run GH Actions locally, I think for now it might be better to just bruteforce them against the real thing :P.

I actually created a separate repo for myself where I can just quickly test how things work on them.

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 this pull request may close these issues.

Handle missing description gracefully
2 participants