Documentation
¶
Index ¶
- Variables
- func CompareSemanticVersion(version, other string) (int, error)
- func Debug(format string, args ...interface{})
- func EncodePackage(p Package, file string) error
- func GetGitHubAuthToken() string
- func Log(format string, args ...interface{})
- func LogError(err error, format string, args ...interface{})
- func Output(format string, args ...interface{})
- type Bugs
- type Dependencies
- type GitHub
- func (g *GitHub) AddCommentToIssue(comment string, issue Issue) error
- func (g *GitHub) AddCommentToPullRequest(comment string, pr PullRequest) error
- func (g *GitHub) AddIssue(title, body string, project Project) (Issue, error)
- func (g *GitHub) AddLabelToIssue(label string, issue Issue) error
- func (g *GitHub) AddLabelToPullRequest(label string, pr PullRequest) error
- func (g *GitHub) AddLabelToRepository(label, color, description string, project Project) error
- func (g *GitHub) ArchiveRepository(project Project) error
- func (g *GitHub) DeleteAllWebHooks(project Project) error
- func (g *GitHub) GetOpenIssues(organization, name string) ([]Issue, error)
- func (g *GitHub) GetOpenPullRequests(organization, name string) ([]PullRequest, error)
- func (g *GitHub) GetProject(organization, name string) (Project, error)
- func (g *GitHub) ListProjects(organization, prefix string, mods ...string) ([]Project, error)
- func (g *GitHub) Transfer(project Project, organization string) error
- func (g *GitHub) UpdateTopics(topics []string, project Project) error
- type Integration
- type IntegrationRepo
- type Issue
- type Monorepo
- func (m *Monorepo) AddIntegrationRepo(integration IntegrationRepo) (string, error)
- func (m *Monorepo) ConnectToGitHub(github *GitHub, organization, name string) error
- func (m *Monorepo) ListUpdatedIntegrationsSinceCommit(commitID string) (map[string]*Integration, error)
- func (m *Monorepo) OpenAllIntegrations() (map[string]*Integration, error)
- func (m *Monorepo) OpenIntegration(name string) (*Integration, error)
- type Package
- type Project
- type PullRequest
- type Repository
- type Scripts
- type Tag
- type Yarn
Constants ¶
This section is empty.
Variables ¶
var ErrPackageNotFound = errors.New("not found")
ErrPackageNotFound returned by NPM when the package is not found in the registry
var Verbose = false
Verbose prints some extra info
Functions ¶
func CompareSemanticVersion ¶
CompareSemanticVersion returns -1, 0 or 1 if the version is older, the same or newer than the other. See https://godoc.org/github.com/blang/semver#Version.Compare
func Debug ¶
func Debug(format string, args ...interface{})
Debug prints a message if the Verbose flag is set
func EncodePackage ¶
EncodePackage writes the struct into package.json
func GetGitHubAuthToken ¶
func GetGitHubAuthToken() string
GetGitHubAuthToken returns the authentication token if found, if not, it exist the app.
Types ¶
type GitHub ¶
GitHub is a convenient wrapper for the GraphQL client
func NewGitHubClient ¶
func NewGitHubClient() *GitHub
NewGitHubClient creates and authenticates a GraphQL client for GitHub's V4 API.
func (*GitHub) AddCommentToIssue ¶
AddCommentToIssue append a comment to an existing issue
func (*GitHub) AddCommentToPullRequest ¶
func (g *GitHub) AddCommentToPullRequest(comment string, pr PullRequest) error
AddCommentToPullRequest append a comment to an existing issue
func (*GitHub) AddLabelToIssue ¶
AddLabelToIssue adds a label
func (*GitHub) AddLabelToPullRequest ¶
func (g *GitHub) AddLabelToPullRequest(label string, pr PullRequest) error
AddLabelToPullRequest adds a label
func (*GitHub) AddLabelToRepository ¶
AddLabelToRepository adds a label
func (*GitHub) ArchiveRepository ¶
ArchiveRepository patches the repo and archives it
func (*GitHub) DeleteAllWebHooks ¶
DeleteAllWebHooks retrieves and deletes all webhooks for the project
func (*GitHub) GetOpenIssues ¶
GetOpenIssues retrieves a list of opened issues for the given project
func (*GitHub) GetOpenPullRequests ¶
func (g *GitHub) GetOpenPullRequests(organization, name string) ([]PullRequest, error)
GetOpenPullRequests retrieves a list of opened pull requests for the given project
func (*GitHub) GetProject ¶
GetProject returns the GitHub repo info
func (*GitHub) ListProjects ¶
ListProjects retrieves all repositories starting with prefix
type Integration ¶
type Integration struct { Name string Path string Package Package // contains filtered or unexported fields }
Integration represents an integration contained in the monorepo
type IntegrationRepo ¶
type IntegrationRepo struct { Name string Project Repo *git.Repository OpenIssues []Issue OpenPullRequests []PullRequest // contains filtered or unexported fields }
IntegrationRepo represents an old integration with its own repository
func OpenIntegrationRepo ¶
func OpenIntegrationRepo(github *GitHub, organization, name, dst string) (*IntegrationRepo, error)
OpenIntegration gets the project from GitHub and clones the repo locally
func (*IntegrationRepo) Archive ¶
func (i *IntegrationRepo) Archive(github *GitHub) error
Archive archives the repo and removes webhooks.
func (*IntegrationRepo) IsMigrated ¶
func (i *IntegrationRepo) IsMigrated() bool
IsMigrated returns true if the repo has been commited to the monorepo and all the issues and open requests have been migrated
func (*IntegrationRepo) MigrateToMonorepo ¶
func (i *IntegrationRepo) MigrateToMonorepo(github *GitHub, monorepo *Monorepo) error
MigrateToMonorepo commits the source code to the monorepo, migrates issues and pull requests, and updates the readme.
func (*IntegrationRepo) MoveToBoneyard ¶
func (i *IntegrationRepo) MoveToBoneyard(github *GitHub, boneyard string) error
MoveToBoneyard moves the repo to the boneyard organization only if it was archived and migrated.
type Issue ¶
type Issue struct { ID string Number int Title string URL string Body string Author string PublishedAt time.Time UpdatedAt time.Time Labels []string Organization string RepositoryName string }
Issue represents a GitHub issue
type Monorepo ¶
Monorepo
func OpenMonorepo ¶
OpenMonorepo returns the git repository of the monorepo
func (*Monorepo) AddIntegrationRepo ¶
func (m *Monorepo) AddIntegrationRepo(integration IntegrationRepo) (string, error)
AddIntegrationRepo adds the integration files into the monorepo as a folder, and commits the results. It returns the new commit's link.
func (*Monorepo) ConnectToGitHub ¶
ConnectToGitHub updates the struct containing GitHub metadata. This was separated from `OpenMonorepo` because in some ocasions we don't need all GitHub information.
func (*Monorepo) ListUpdatedIntegrationsSinceCommit ¶
func (m *Monorepo) ListUpdatedIntegrationsSinceCommit(commitID string) (map[string]*Integration, error)
ListUpdatedIntegrationsSinceCommit compare the current state of the integration with a commit (oid or ref) and return the integrations that have change.
func (*Monorepo) OpenAllIntegrations ¶
func (m *Monorepo) OpenAllIntegrations() (map[string]*Integration, error)
OpenAllIntegrations scans the integration folder
func (*Monorepo) OpenIntegration ¶
func (m *Monorepo) OpenIntegration(name string) (*Integration, error)
OpenIntegration retuns a reference to the integration stored in the monorepo.
type Package ¶
type Package struct { Name string `json:"name"` Description string `json:"description"` Version string `json:"version"` Keywords []string `json:"keywords"` Main string `json:"main"` Scripts Scripts `json:"scripts"` Author string `json:"author"` License string `json:"license"` Homepage string `json:"homepage"` Bugs Bugs `json:"bugs"` Repository Repository `json:"repository"` Dependencies Dependencies `json:"dependencies"` DevDependencies Dependencies `json:"devDependencies"` }
Package is the representation of package.json
func DecodePackage ¶
DecodePackage parses package.json into the struct
type Project ¶
type Project struct { ID string URL string Organization string RepositoryName string IsPrivate bool Forks int OpenPullRequests int OpenIssues int LastUpdated time.Time Labels []string Topics []string IsArchived bool }
Project represents a GitHub project
type PullRequest ¶
type PullRequest struct { ID string Number int Title string URL string Body string Author string PublishedAt time.Time UpdatedAt time.Time Labels []string Organization string RepositoryName string }
PullRequest represents a GitHub pull request
type Repository ¶
Repository from package.json
type Tag ¶
type Tag struct { Name string When time.Time IsAnnotated bool Tag *git.Tag // for annotated Commit *git.Commit // for lightweight }
Tag is an annotated or lightweight tag