-
-
Notifications
You must be signed in to change notification settings - Fork 459
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
Release Assets for private repo: Missing Access Token? #475
Comments
Let me take a look. Can you give |
Sure :) I just sent you an invite. |
Thanks. I'll take a closer look. |
Hmm. I'm looking locally and after installing and attempting to update, the download link has the access token, but I'm getting what appears to be a 404 error, Download failed. Not found. Yes the link works when copied into a browser window. Still looking. |
Thanks for following up so quickly and thoroughly. You're right, I can't even reach the URL via command line/curl. It always 404s. I contacted Github, asking if it's a bug on their end. Will follow up here once they reply. |
Thanks |
Here's the answer from GitHub
That didn't really help but I found a solution diving into the API again: Assuming we already know the tag name (which is the case in Github Updater), we can access the release directly like this:
Which returns {
"url": "...",
"assets": [
{
"url": "https://api.github.com/repos/ORG/REPO/releases/assets/123456",
"id": 123456,
"name": "br-wordpress-podlove-publisher-s3-v0.1.3.zip",
"label": "",
"uploader": {
...
},
"content_type": "application/zip",
"state": "uploaded",
"size": 1167766,
"download_count": 9,
"created_at": "2016-10-25T12:36:34Z",
"updated_at": "2016-10-25T12:36:38Z",
"browser_download_url": "https://github.com/ORG/REPO/releases/download/v0.1.3/br-wordpress-podlove-publisher-s3-v0.1.3.zip"
}, {
# more assets
}
]
} There can be multiple assets. You could apply the already defined naming scheme and filter, or simply take the first asset. Now, the However, I found this in the API docs:
This works—heureka! 💡
It's probably a fair bit of work to implement but the approach should work. Until then you should add to the readme that asset downloading does not work for private repos for now. |
Thanks! Great digging. Why couldn't it just be like public repos? 😝 I'll dig through this and figure out a fix. I'll let you know, but likely to take a couple of days. |
Awesome :) Will give it a try in the next few days and report back. Read the commit just now and it looks great. Maybe mention in the docs that the first asset will be used, although I imagine few people will have more than one anyway. |
The latest asset is the one used. https://developer.github.com/v3/repos/releases/#get-the-latest-release I think it only returns a single asset. Also, because of the new HTTP lib in WP 4.6; this is minimum requirement. |
Just activated 6.0.0.6, now the plugins page shows a whitescreen with:
|
Forcing an array response for the api call fixes it for me: # src/GitHub_Updater/GitHub_API.php l.134
$response = (array) $this->api( '/repos/:owner/:repo/contents/' . $changes ); |
I changed the format of the transient for optimization. Depending upon how you updated you could get this error. Install https://github.com/afragen/clear-github-updater-cache it will clear your transients and then deactivate. |
Ah, that makes sense. Thanks :) |
If you update to the latest develop 6.0.0.8, it should automatically take care of that problem. Also, is the release asset update working? |
@eteubert have you had a chance to re-test with the latest develop branch? |
Gave it a try with 6.0.0.16 and it worked 👍 |
Hi,
I tried using the "Release Assets" feature with a private repo. From the plugin update screen I can see it's trying to fetch the correct file.
But it 404 fails. When I copy the URL to my browser, I can access and download it. Is it possible that the configured access token is not used here?
The text was updated successfully, but these errors were encountered: