Skip to content

[BUG]: rest.packages.listPackagesForOrganization return 400 Invalid argument with package type 'container' #449

Description

@SteeveGL

What happened?

I'm using actions/[email protected] to call github.rest.packages.listPackagesForOrganization. When I'm using it with other package types, I don't have any issue. but 'container' type returns error 400. I expect 200.

I cannot reproduce by using a http call on the api url with a personal token.

...
let packagesResponse;
try {
  packagesResponse = await github.rest.packages.listPackagesForOrganization({
    org: org,
    package_type: 'container'
  });
} catch (error) {
  console.error(`Error fetching packages of type ${packageType}:`, error);
  continue;
}
...

Same result with:

let packagesResponse;
try {
  packagesResponse = await github.request('GET /orgs/{org}/packages', {
    org: org,
    package_type: packageType
  });
} catch (error) {
  console.error(`Error fetching packages of type ${packageType}:`, error);
  continue;
}

https://github.dev/UtopikSandcastle/accesscontrol-api/blob/UtopikSolutions-patch-1/.github/workflows/cleanup.yml

Versions

actions/github-script@v7

Relevant log output

Error fetching packages of type container: RequestError [HttpError]: Invalid argument.
    at /home/runner/work/_actions/actions/github-script/v7.0.1/dist/index.js:9537:21
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async eval (eval at callAsyncFunction (/home/runner/work/_actions/actions/github-script/v7.0.1/dist/index.js:35424:16), <anonymous>:36:24)
    at async main (/home/runner/work/_actions/actions/github-script/v7.0.1/dist/index.js:35522:20) {
  status: 400,
  response: {
    url: 'https://api.github.com/orgs/UtopikSandcastle/packages?package_type=container&per_page=30',
    status: 400,
    headers: {
      'access-control-allow-origin': '*',
      'access-control-expose-headers': 'ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset',
      'content-length': '134',
      'content-security-policy': "default-src 'none'",
      'content-type': 'application/json; charset=utf-8',
      date: 'Fri, 12 Jan 2024 00:32:41 GMT',
      'referrer-policy': 'origin-when-cross-origin, strict-origin-when-cross-origin',
      server: 'GitHub.com',
      'strict-transport-security': 'max-age=31536000; includeSubdomains; preload',
      vary: 'Accept-Encoding, Accept, X-Requested-With',
      'x-content-type-options': 'nosniff',
      'x-frame-options': 'deny',
      'x-github-api-version-selected': '2022-11-28',
      'x-github-media-type': 'github.v3; format=json',
      'x-github-request-id': '34C1:75F1:31F4D60:33B551F:65A088A9',
      'x-ratelimit-limit': '1000',
      'x-ratelimit-remaining': '909',
      'x-ratelimit-reset': '1705020148',
Checking package type: npm
      'x-ratelimit-resource': 'core',
      'x-ratelimit-used': '91',
      'x-xss-protection': '0'
    },
    data: {
      message: 'Invalid argument.',
      documentation_url: 'https://docs.github.com/rest/packages/packages#list-packages-for-an-organization'
    }
  },
  request: {
    method: 'GET',
    url: 'https://api.github.com/orgs/UtopikSandcastle/packages?package_type=container&per_page=30',
    headers: {
      accept: 'application/vnd.github.v3+json',
      'user-agent': 'actions/github-script octokit-core.js/5.0.1 Node.js/20.8.1 (linux; x64)',
      authorization: 'token [REDACTED]'
    },
    request: {
      agent: [Agent],
      fetch: [Function: proxyFetch],
      hook: [Function: bound bound register]
    }
  }
}

Activity

  1. SteeveGL commented on Jan 12, 2024

    @SteeveGL
    Author

    Seems GitHub token is still not supported pour container...

    https://github.com/orgs/community/discussions/26268#discussioncomment-3251118

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions