ccaddrepo

package module
v1.1.12 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 9, 2021 License: MIT Imports: 12 Imported by: 0

README

ccaddrepo

Add a repository to CodeClimate and add its report id as a secret to GitHub repository.

Documentation

Contributing

License

MIT Licensed

© 2021

Documentation

Overview

Package ccaddrepo allows to add a GitHub repository to CodeClimate and setup its report id as a CC_TEST_REPORTER_ID secret in the repository.

This two function works together in order to automate the setup of a GitHub repository.

If you are using this package in GitHub Actions, you can easily publish coverages reports to CodeClimate using e.g. paambaati/codeclimate-action(https://github.com/paambaati/codeclimate-action)

Package ccaddrepo allows to add a GitHub repository to CodeClimate and setup its report id as a CC_TEST_REPORTER_ID secret in the repository.

This two function works together in order to automate the setup of a GitHub repository.

If you are using this package in GitHub Actions, you can easily publish coverages reports to CodeClimate using e.g. paambaati/codeclimate-action(https://github.com/paambaati/codeclimate-action)

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetReporterIDSecret

func SetReporterIDSecret(options SecretsOptions) error

SetReporterIDSecret setup a secret on a github repository named CC_TEST_REPORTER_ID containing the specified reporterID. The function uses GitHub API to add the secret, so a ghtoken has to be specified.

Example
package main

import (
	"github.com/parrogo/ccaddrepo"
)

func main() {
	err := ccaddrepo.SetReporterIDSecret(ccaddrepo.SecretsOptions{
		RepoSlug:   "",
		GHToken:    "",
		ReporterID: "",
		BadgeID:    "",
		ID:         "",
	})
	if err != nil {
		panic(err)
	}
}
Output:

Types

type CodeClimate added in v1.1.5

type CodeClimate string

CodeClimate represent an authenticated session on Code Climate.

Example

This example show how to use ccaddrepo.AddOnCodeClimate()

package main

import (
	"fmt"

	"github.com/parrogo/ccaddrepo"
)

func main() {
	cc := ccaddrepo.CodeClimate("token")
	reporterID, err := cc.AddRepo("author/repo")
	if err != nil {
		panic(err)
	}
	fmt.Println(reporterID)

}
Output:

func (CodeClimate) AddRepo added in v1.1.5

func (cc CodeClimate) AddRepo(reposlug string) (*RepoInfo, error)

AddRepo create a repository within an organization and return the reporter ID.

func (CodeClimate) DeleteRepo added in v1.1.5

func (cc CodeClimate) DeleteRepo(repoid string) error

DeleteRepo remove a repository from CodeClimate

func (CodeClimate) GetOwnOrgID added in v1.1.5

func (cc CodeClimate) GetOwnOrgID(orgname string) (string, error)

GetOwnOrgID returns the ID of an organization

func (CodeClimate) GetRepoID added in v1.1.5

func (cc CodeClimate) GetRepoID(reposlug string) (string, error)

GetRepoID returns the ID of a repository

type RepoInfo added in v1.1.10

type RepoInfo struct {
	Data struct {
		ID         string
		Attributes struct {
			TestReporterID string `json:"test_reporter_id"`
			BadgeTokenID   string `json:"badge_token"`
		}
	}
}

RepoInfo represents the information retrieved from a repo

type SecretsOptions added in v1.1.11

type SecretsOptions struct {
	RepoSlug   string
	GHToken    string
	ReporterID string
	BadgeID    string
	ID         string
}

SecretsOptions contains all the options to setup Code Climate related secrets in a GH repo.

Directories

Path Synopsis
cli

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL