-
Notifications
You must be signed in to change notification settings - Fork 31
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
V3 Failed to fetch packages with temporal token #96
Comments
Thanks for the report! Are you able to run this, in a workflow? - run: |
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/orgs/{{ account }}/packages/container/{{ image1 }}
- run: |
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/orgs/{{ account }}/packages/container/{{ image2 }} (replace For each of your images? You should get a response like this: {
"id": 6611266,
"name": "container-retention-policy",
"package_type": "container",
"owner": {
"login": "snok",
"id": 64945977,
"node_id": "MDEyOk9yZ2FuaXphdGlvbjY0OTQ1OTc3",
"avatar_url": "https://avatars.githubusercontent.com/u/64945977?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/snok",
"html_url": "https://github.com/snok",
"followers_url": "https://api.github.com/users/snok/followers",
"following_url": "https://api.github.com/users/snok/following{/other_user}",
"gists_url": "https://api.github.com/users/snok/gists{/gist_id}",
"starred_url": "https://api.github.com/users/snok/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/snok/subscriptions",
"organizations_url": "https://api.github.com/users/snok/orgs",
"repos_url": "https://api.github.com/users/snok/repos",
"events_url": "https://api.github.com/users/snok/events{/privacy}",
"received_events_url": "https://api.github.com/users/snok/received_events",
"type": "Organization",
"site_admin": false
},
"version_count": 20,
"visibility": "public",
"url": "https://api.github.com/orgs/snok/packages/container/container-retention-policy",
"created_at": "2024-05-27T20:20:13Z",
"updated_at": "2024-08-07T08:27:09Z",
"repository": {
"id": 395465327,
"node_id": "MDEwOlJlcG9zaXRvcnkzOTU0NjUzMjc=",
"name": "container-retention-policy",
"full_name": "snok/container-retention-policy",
"private": false,
"owner": {
"login": "snok",
"id": 64945977,
"node_id": "MDEyOk9yZ2FuaXphdGlvbjY0OTQ1OTc3",
"avatar_url": "https://avatars.githubusercontent.com/u/64945977?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/snok",
"html_url": "https://github.com/snok",
"followers_url": "https://api.github.com/users/snok/followers",
"following_url": "https://api.github.com/users/snok/following{/other_user}",
"gists_url": "https://api.github.com/users/snok/gists{/gist_id}",
"starred_url": "https://api.github.com/users/snok/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/snok/subscriptions",
"organizations_url": "https://api.github.com/users/snok/orgs",
"repos_url": "https://api.github.com/users/snok/repos",
"events_url": "https://api.github.com/users/snok/events{/privacy}",
"received_events_url": "https://api.github.com/users/snok/received_events",
"type": "Organization",
"site_admin": false
},
"html_url": "https://github.com/snok/container-retention-policy",
"description": "GitHub action for pruning old GHCR container image versions.",
"fork": false,
"url": "https://api.github.com/repos/snok/container-retention-policy",
"forks_url": "https://api.github.com/repos/snok/container-retention-policy/forks",
"keys_url": "https://api.github.com/repos/snok/container-retention-policy/keys{/key_id}",
"collaborators_url": "https://api.github.com/repos/snok/container-retention-policy/collaborators{/collaborator}",
"teams_url": "https://api.github.com/repos/snok/container-retention-policy/teams",
"hooks_url": "https://api.github.com/repos/snok/container-retention-policy/hooks",
"issue_events_url": "https://api.github.com/repos/snok/container-retention-policy/issues/events{/number}",
"events_url": "https://api.github.com/repos/snok/container-retention-policy/events",
"assignees_url": "https://api.github.com/repos/snok/container-retention-policy/assignees{/user}",
"branches_url": "https://api.github.com/repos/snok/container-retention-policy/branches{/branch}",
"tags_url": "https://api.github.com/repos/snok/container-retention-policy/tags",
"blobs_url": "https://api.github.com/repos/snok/container-retention-policy/git/blobs{/sha}",
"git_tags_url": "https://api.github.com/repos/snok/container-retention-policy/git/tags{/sha}",
"git_refs_url": "https://api.github.com/repos/snok/container-retention-policy/git/refs{/sha}",
"trees_url": "https://api.github.com/repos/snok/container-retention-policy/git/trees{/sha}",
"statuses_url": "https://api.github.com/repos/snok/container-retention-policy/statuses/{sha}",
"languages_url": "https://api.github.com/repos/snok/container-retention-policy/languages",
"stargazers_url": "https://api.github.com/repos/snok/container-retention-policy/stargazers",
"contributors_url": "https://api.github.com/repos/snok/container-retention-policy/contributors",
"subscribers_url": "https://api.github.com/repos/snok/container-retention-policy/subscribers",
"subscription_url": "https://api.github.com/repos/snok/container-retention-policy/subscription",
"commits_url": "https://api.github.com/repos/snok/container-retention-policy/commits{/sha}",
"git_commits_url": "https://api.github.com/repos/snok/container-retention-policy/git/commits{/sha}",
"comments_url": "https://api.github.com/repos/snok/container-retention-policy/comments{/number}",
"issue_comment_url": "https://api.github.com/repos/snok/container-retention-policy/issues/comments{/number}",
"contents_url": "https://api.github.com/repos/snok/container-retention-policy/contents/{+path}",
"compare_url": "https://api.github.com/repos/snok/container-retention-policy/compare/{base}...{head}",
"merges_url": "https://api.github.com/repos/snok/container-retention-policy/merges",
"archive_url": "https://api.github.com/repos/snok/container-retention-policy/{archive_format}{/ref}",
"downloads_url": "https://api.github.com/repos/snok/container-retention-policy/downloads",
"issues_url": "https://api.github.com/repos/snok/container-retention-policy/issues{/number}",
"pulls_url": "https://api.github.com/repos/snok/container-retention-policy/pulls{/number}",
"milestones_url": "https://api.github.com/repos/snok/container-retention-policy/milestones{/number}",
"notifications_url": "https://api.github.com/repos/snok/container-retention-policy/notifications{?since,all,participating}",
"labels_url": "https://api.github.com/repos/snok/container-retention-policy/labels{/name}",
"releases_url": "https://api.github.com/repos/snok/container-retention-policy/releases{/id}",
"deployments_url": "https://api.github.com/repos/snok/container-retention-policy/deployments"
},
"html_url": "https://github.com/orgs/snok/packages/container/package/container-retention-policy"
} Which should be parsable by our #[derive(Debug, Clone, Deserialize)]
pub struct Package {
pub id: u32,
pub name: String,
pub created_at: DateTime<Utc>,
pub updated_at: Option<DateTime<Utc>>,
} The error message you get, seems to indicate that you're not able to fetch the data properly, but let's make sure 🙂 |
This helped me! I had the same error message. Using the |
hmm, I'm also struggling to get this to work. I've created a new github app with these permissions:
I've installed it in my org and given it access to all repos.
and I get:
I tried your troubleshooting step above putting this between the generate-token and the container-retention-policy:
and I get:
However, if I make this same curl request from my local machine using a PAT with package:read I get a full response showing the package information and don't get a 404. Any ideas what I'm doing wrong? I'm guessing it must be some permissions issue with the app, but I've already granted it RW packages, RO metadata. I also tried adding read only to contents to see if that would help, but no luck. Thanks! |
I was able to get it working after swapping to the temporal token instead of the github app installation access token. I tried a bunch of different things (recreated and reinstalled the app several times, tried enabling every permission, tried setting repo and permissions explicitly when generating the access token, but no matter what I tried, I would always get a 404 when trying to list packages. I wonder if it's some issue on the github side. Their api docs seem to suggest that an installation access token should work, but who knows. At any rate, the temporal token works for me and is less setup than the app based token anyway. I probably should have just started with that all along! |
How strange. The workflow and permissions seem correct, according to how I've set it up during testing. The image names do need to be percent encoded, if you've got, e.g., a |
I seem to hit the same issue, but with both the temporal GH Token and a personal token. While debugging this, I found that the following URLs worked:
Whereas the suggested URL https://api.github.com/sscheib/packages/container/jekyll-build yields a 404. I have no idea what's causing this or whether GitHub changed the API in the meanwhile. // EDIT Totally my fault. I misunderstood the |
Hehe yeah for potential readers, specifying anything other than |
For me, I resolved the issue by going into package settings and ensuring the package was giving correct permissions to the repo's GitHub Actions. |
when using a list of images (separeted by comma or space) I get an error. if the configuration has only one image name it runs sucessully.
Here a sample of falling:
The text was updated successfully, but these errors were encountered: