Categorygithub.com/telia-oss/githubapp
repositorypackage
0.8.0
Repository: https://github.com/telia-oss/githubapp.git
Documentation: pkg.go.dev

# Packages

No description provided by the author

# README

githubapp

go.dev reference latest release build status code quality

A small Go package for handling authentication with a Github App using owner login and repository names instead of UUIDs. Installations and repositories are cached internally and refreshed (lazily) on a set interval, to reduce the number of List* API calls against the Apps API.

Usage

package main

import (
	"github.com/telia-oss/githubapp"

	"github.com/google/go-github/v45/github"
)

func main() {
    client, err := githubapp.NewClient(911, []byte("private-key"))
    if err != nil {
        panic(err)
    }

    app := githubapp.New(client)

    token, err := app.CreateInstallationToken(
        "telia-oss",
        []string{"githubapp"},
		&githubapp.Permissions{
            Metadata: github.String("read"),
        },
    )
    if err != nil {
        panic(err)
    }
}