Skip to content

Request: Use org and repos name instead of installation ID #7

@pcorpet

Description

@pcorpet

Is there an existing issue that is already proposing this?

  • I have searched the existing issues

Describe the problem imposed by not having this feature

I would prefer not to enter the GitHub App's Installation ID as an env var, and have the orb find it directly using the API. You can get the installation access tokens URL from the /installation URL if you have the org name and the repo name (which you usually have in CircleCI pipeline).

Describe the solution you'd like

parameters:
  org_name:
    description: The name of the GitHub org to get the installation token for.
    type: string
    default: $CIRCLE_PROJECT_USERNAME
  repository_name:
    description: The name of the repository to get the installation token for.
    type: string
    default: $CIRCLE_PROJECT_REPONAME

And then in the script:

installation_access_tokens_url=$(
  curl -s -X GET \
    -H "Authorization: Bearer ${jwt}" \
    -H "Accept: application/vnd.github.v3+json" \
    "https://api.github.com/repos/<< parameters.org_name >>/<< parameters.repository_name >>/installation" \
  | jq -r ".access_tokens_url"
)
auth_token=$(
  curl -s -X POST \
    -H "Authorization: Bearer ${jwt}" \
    -H "Accept: application/vnd.github.v3+json" \
    $installation_access_tokens_url \
  | jq -r ".token"
)

Other

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions