bubalis
bubalis

Reputation: 61

Downloading an artifact from actions on someone else's repository

This problem seems really simple. I'm trying to download a pre-built binary for a program from somebody's github repo.

They suggest that I can do this: "You can also download pre-built binaries from GitHub Actions artifacts."

But it turns out that I have no idea what that means!

The file is not in the actions page (I'm not sure if it should be) and when I try:

curl -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/nbdd0121/wsld/actions/artifacts/42682371/zip

I receive { "message": "You must have the actions scope to download artifacts.", "documentation_url": "https://docs.github.com/rest/reference/actions#download-an-artifact" }

But this documentation implies that I need to Build an app in order to download a file???

Can this possibly be correct?

What am I missing here?

Upvotes: 4

Views: 2892

Answers (3)

Tharindu Weerasinghe
Tharindu Weerasinghe

Reputation: 103

"You must have the actions scope to download artifacts."

This means that your github PAT does not have the required scope to download this artifact. When you generate the token you have to select the following scopes to be able to download artifact over a curl:

Github token select scope

Note: You only need to select workflow and read:packages. The repo scope is automatically added when you select workflow

Upvotes: 0

vgm
vgm

Reputation: 158

You can also directly use Basic auth. In curl:

curl -L -u <USERNAME>:<PERSONAL_ACCESS_TOKEN> -o artifact.zip https://api.github.com/repos/nbdd0121/wsld/actions/artifacts/42682371/zip

And the personal access token is generated at: https://github.com/settings/tokens

Upvotes: 1

Zombo
Zombo

Reputation: 1

This works for me:

curl.exe `
--netrc-file C:\Users\Steven\_netrc `
-L `
-o wsldhost.exe.zip `
https://api.github.com/repos/nbdd0121/wsld/actions/artifacts/42682371/zip

Where _netrc looks like this:

default login <USERNAME> password <PERSONAL ACCESS TOKEN>

https://github.com/actions/upload-artifact/issues/89

Upvotes: 2

Related Questions