Open
Description
I've been trying to use octocrab
to replace a bash script which uses gh api
, however I can't get the authentication to work.
For the folllowing code
/// this token has the required permissons per the github documentation and works fine when using `gh api`
let auth_token = std::env::var("GITHUB_TOKEN")
.context("GITHUB_TOKEN is required to authenticate with the Github API")?;
let crab = octocrab::OctocrabBuilder::new()
.personal_token(auth_token)
.build()
.context("Failed to construct Octocrab configuration")?;
let jit_config = crab
.actions()
.create_repo_jit_runner_config(
config.owner,
config.repo,
config.name,
config.runner_group_id.into(),
config.labels,
)
.send()
.await?;
Octocrab gives this error:
...
[2024-12-17T07:15:51Z DEBUG octocrab] HTTP; http.status_code=403
[2024-12-17T07:15:51Z DEBUG octocrab] HTTP; otel.status_code="ERROR"
Error: Failed to spawn runner
Caused by:
0: GitHub
1: Forbidden
Documentation URL: https://docs.github.com/rest/actions/self-hosted-runners#create-configuration-for-a-just-in-time-runner-for-a-repository
Can octocrab only be used for making github apps or am I doing something wrong here? As mentioned above the same token works perfectly when using gh api
.
Metadata
Metadata
Assignees
Labels
No labels