How to list workflows from a private repository

Fetching this endpoint is working fine using a public repository. But how can I do this when using a private repository? There is no documentation regarding authentication and such.

The documentation you linked describes the requirement:

If the repository is private you must use an access token with the repo scope. GitHub Apps must have the actions:read permission to use this endpoint.

For generating an access token, see Creating a personal access token. Once you have it, you need to add an Authorization header to the HTTP request, with the content token YOUR-TOKEN.

1 Like

Thank you, that wasn’t obvious at first glance due to the lack of example. I’ll give it a try.

1 Like

Worked that way:

    const response = await fetch(GITHUB_API_LIST_PROJECT_WORKFLOWS, {
      headers: {
        Authorization: `token ${process.env.GITHUB_TOKEN}`,
1 Like