package github

import "github.com/oslokommune/okctl/pkg/github"

Package github provides a client for interacting with the Github API

Index

Constants

const DefaultAWSInfrastructurePrimaryBranch = "master"

DefaultAWSInfrastructurePrimaryBranch is the name of the primary branch (due to git/github moving away from "master" to "main")

const DefaultAWSInfrastructureRepository = "origo-aws-infrastructure"

DefaultAWSInfrastructureRepository is the name of the infrastructure as code repository which should be given nameserver delegation requests

const DefaultOrg = "oslokommune"

DefaultOrg is the default organisation used with okctl

const ListReleasesPageSize = 100

ListReleasesPageSize is the number of releases to fetch per page

Functions

func BoolPtr

func BoolPtr(v bool) *bool

BoolPtr returns a pointer to the bool

func Int64Ptr

func Int64Ptr(v int64) *int64

Int64Ptr returns a pointer to the int64

func StringPtr

func StringPtr(v string) *string

StringPtr returns a pointer to the string

Types

type Github

type Github struct {
	Ctx    context.Context
	Client *github.Client
}

Github contains the state for interacting with the github API

func New

New returns an initialised github API client

func (*Github) CreateDeployKey

func (g *Github) CreateDeployKey(org, repository, title, publicKey string) (*Key, error)

CreateDeployKey creates a read-only deploy key for the given owner/repo

func (*Github) CreatePullRequest

func (g *Github) CreatePullRequest(r *PullRequest) error

CreatePullRequest creates a pull request from sourceBranch to destinationBranch

func (*Github) DeleteDeployKey

func (g *Github) DeleteDeployKey(org, repository string, identifier int64) error

DeleteDeployKey removes a read-only deploy key

func (*Github) ListReleases

func (g *Github) ListReleases(owner, repo string) ([]*RepositoryRelease, error)

ListReleases lists the given repository's releases

func (*Github) Repositories

func (g *Github) Repositories(org string) ([]*Repository, error)

Repositories fetches all the repositories within the given organisation

func (*Github) Teams

func (g *Github) Teams(org string) ([]*Team, error)

Teams fetches all teams within the given organisation

type Githuber

type Githuber interface {
	Teams(org string) ([]*Team, error)
	Repositories(org string) ([]*Repository, error)
	CreateDeployKey(org, repository, title, publicKey string) (*Key, error)
	DeleteDeployKey(org, repository string, id int64) error
	CreatePullRequest(r *PullRequest) error
	ListReleases(owner, repo string) ([]*RepositoryRelease, error)
}

Githuber invokes the github API

type Key

type Key = github.Key

Key shadows github.Key

type PullRequest

type PullRequest struct {
	Organisation      string
	Repository        string
	SourceBranch      string
	DestinationBranch string
	Title             string
	Body              string
	Labels            []string
}

PullRequest contains data about the PR

type ReleaseAsset

type ReleaseAsset = github.ReleaseAsset

ReleaseAsset shadows github.ReleaseAsset

type Repository

type Repository = github.Repository

Repository shadows github.Repository

type RepositoryRelease

type RepositoryRelease = github.RepositoryRelease

RepositoryRelease shadows github.RepositoryRelease

type Team

type Team = github.Team

Team shadows github.Team

Source Files

github.go

Version
v0.0.106 (latest)
Published
Oct 21, 2022
Platform
linux/amd64
Imports
5 packages
Last checked
18 hours ago

Tools for package owners.