Documentation ¶
Index ¶
- Constants
- func TrackEventIfMissing(slice []*github.Repository, repo *github.Repository) []*github.Repository
- type RunStats
- func (r *RunStats) GenerateRunReport() *types.RunReport
- func (r *RunStats) GetDraftPullRequests() map[string]string
- func (r *RunStats) GetFileProvidedRepos() []*types.AllowedRepo
- func (r *RunStats) GetMultiple(event types.Event) []*github.Repository
- func (r *RunStats) GetPullRequests() map[string]string
- func (r *RunStats) GetRepos() map[types.Event][]*github.Repository
- func (r *RunStats) GetSelectionMode() string
- func (r *RunStats) GetSkippedArchivedRepos() map[types.Event][]*github.Repository
- func (r *RunStats) GetTotalRunSeconds() int
- func (r *RunStats) PrintReport()
- func (r *RunStats) SetCommand(c []string)
- func (r *RunStats) SetFileProvidedRepos(fileProvidedRepos []*types.AllowedRepo)
- func (r *RunStats) SetRepoFlagProvidedRepos(repoFlagProvidedRepos []*types.AllowedRepo)
- func (r *RunStats) SetSelectionMode(mode string)
- func (r *RunStats) SetSkipPullRequests(skipPullRequests bool)
- func (r *RunStats) TrackDraftPullRequest(repoName, prURL string)
- func (r *RunStats) TrackMultiple(event types.Event, repos []*github.Repository)
- func (r *RunStats) TrackPullRequest(repoName, prURL string)
- func (r *RunStats) TrackSingle(event types.Event, repo *github.Repository)
Constants ¶
const ( // DryRunSet denotes a repo will not have any file changes, branches made or PRs opened because the dry-run flag was set to true DryRunSet types.Event = "dry-run-set-no-changes-made" // ReposSelected denotes all the repositories that were targeted for processing by this tool AFTER filtering was applied to determine valid repos ReposSelected types.Event = "repos-selected-pre-processing" // ReposArchivedSkipped denotes all the repositories that were skipped from the list of repos to clone because the skip-archived-repos was set to true ReposArchivedSkipped types.Event = "repos-archived-skipped" // TargetBranchNotFound denotes the special branch used by this tool to make changes on was not found on lookup, suggesting it should be created TargetBranchNotFound types.Event = "target-branch-not-found" // TargetBranchAlreadyExists denotes the special branch used by this tool was already found (so it was likely already created by a previous run) TargetBranchAlreadyExists types.Event = "target-branch-already-exists" // TargetBranchLookupErr denotes an issue performing the lookup via GitHub API for the target branch - an API call failure TargetBranchLookupErr types.Event = "target-branch-lookup-err" // TargetBranchSuccessfullyCreated denotes a repo for which the target branch was created via GitHub API call TargetBranchSuccessfullyCreated types.Event = "target-branch-successfully-created" // FetchedViaGithubAPI denotes a repo was successfully listed by calling the GitHub API FetchedViaGithubAPI types.Event = "fetch-via-github-api" // RepoSuccessfullyCloned denotes a repo that was cloned to the local filesystem of the operator's machine RepoSuccessfullyCloned types.Event = "repo-successfully-cloned" // RepoFailedToClone denotes that for whatever reason we were unable to clone the repo to the local system RepoFailedToClone types.Event = "repo-failed-to-clone" // BranchCheckoutFailed denotes a failure to checkout a new tool specific branch in the given repo BranchCheckoutFailed types.Event = "branch-checkout-failed" // GetHeadRefFailed denotes a repo for which the HEAD git reference could not be obtained GetHeadRefFailed types.Event = "get-head-ref-failed" // CommandErrorOccurredDuringExecution denotes a repo for which the supplied command failed to be executed CommandErrorOccurredDuringExecution types.Event = "command-error-during-execution" // WorktreeStatusCheckFailed denotes a repo whose git status command failed post command execution WorktreeStatusCheckFailed types.Event = "worktree-status-check-failed" // WorktreeStatusCheckFailedCommand denotes a repo whose git status command failed following command execution WorktreeStatusCheckFailedCommand = "worktree-status-check-failed-command" // WorktreeStatusDirty denotes repos that had local file changes following execution of all their targeted WorktreeStatusDirty types.Event = "worktree-status-dirty" // WorktreeStatusClean denotes a repo that did not have any local file changes following command execution WorktreeStatusClean types.Event = "worktree-status-clean" // WorktreeAddFileFailed denotes a failure to add at least one file to the git stage following command execution WorktreeAddFileFailed types.Event = "worktree-add-file-failed" // CommitChangesFailed denotes an error git committing our file changes to the local repo CommitChangesFailed types.Event = "commit-changes-failed" // PushBranchFailed denotes a repo whose new tool-specific branch could not be pushed to remote origin PushBranchFailed types.Event = "push-branch-failed" // PushBranchSkipped denotes a repo whose local branch was not pushed due to the --dry-run flag being set PushBranchSkipped types.Event = "push-branch-skipped" // RepoNotExists denotes a repo + org combo that was supplied via file but could not be successfully looked up via the GitHub API (returned a 404) RepoNotExists types.Event = "repo-not-exists" // PullRequestOpenErr denotes a repo whose pull request containing config changes could not be made successfully PullRequestOpenErr types.Event = "pull-request-open-error" // PullRequestAlreadyExists denotes a repo where the pull request already exists for the requested branch, so we didn't open a new one PullRequestAlreadyExists types.Event = "pull-request-already-exists" // CommitsMadeDirectlyToBranch denotes a repo whose local worktree changes were committed directly to the specified branch because the --skip-pull-requests flag was passed CommitsMadeDirectlyToBranch types.Event = "commits-made-directly-to-branch" // DirectCommitsPushedToRemoteBranch denotes a repo whose changes were pushed to the remote specified branch because the --skip-pull-requests flag was passed DirectCommitsPushedToRemoteBranch types.Event = "direct-commits-pushed-to-remote" // BranchRemotePullFailed denotes a repo whose remote branch could not be fetched successfully BranchRemotePullFailed types.Event = "branch-remote-pull-failed" // BranchRemoteDidntExistYet denotes a repo whose specified branch didn't exist remotely yet and so was just created locally to begin with BranchRemoteDidntExistYet types.Event = "branch-remote-didnt-exist-yet" // RepoFlagSuppliedRepoMalformed denotes a repo passed via the --repo flag that was malformed (perhaps missing it's Github org prefix) and therefore unprocessable RepoFlagSuppliedRepoMalformed types.Event = "repo-flag-supplied-repo-malformed" // RepoDoesntSupportDraftPullRequestsErr denotes a repo that is incompatible with the submitted pull request configuration RepoDoesntSupportDraftPullRequestsErr types.Event = "repo-not-compatible-with-pull-config" // BaseBranchTargetInvalidErr denotes a repo that does not have the base branch specified by the user BaseBranchTargetInvalidErr types.Event = "base-branch-target-invalid" // PRFailedDueToRateLimits denotes a repo whose initial pull request failed as a result of being rate limited by GitHub PRFailedDueToRateLimitsErr types.Event = "pr-failed-due-to-rate-limits" // PRFailedAfterMaximumRetriesErr denotes a repo whose pull requests all failed to be created via GitHub following the maximum number of retries PRFailedAfterMaximumRetriesErr types.Event = "pr-failed-after-maximum-retries" // RequestReviewersErr denotes a repo whose follow up request to add reviewers to the opened pull request failed RequestReviewersErr types.Event = "request-reviewers-error" )
Variables ¶
This section is empty.
Functions ¶
func TrackEventIfMissing ¶
func TrackEventIfMissing(slice []*github.Repository, repo *github.Repository) []*github.Repository
TrackEventIfMissing prevents the addition of duplicates to the tracking slices. Repos may end up with file changes for example, from multiple command runs, so we don't need the same repo repeated multiple times in the final report
Types ¶
type RunStats ¶
type RunStats struct {
// contains filtered or unexported fields
}
RunStats will be a stats-tracker class that keeps score of which repos were touched, which were considered for update, which had branches made, PRs made, which were missing workflows or contexts, or had out of date workflows syntax values, etc
func NewStatsTracker ¶
func NewStatsTracker() *RunStats
NewStatsTracker initializes a tracker struct that is capable of keeping tabs on which repos were handled and how
func (*RunStats) GenerateRunReport ¶
GenerateRunReport creates a struct that contains all the information necessary to print a final summary report
func (*RunStats) GetDraftPullRequests ¶
GetDraftPullRequests returns the inner representation of the draft pull requests that were opened during the lifecycle of a given run
func (*RunStats) GetFileProvidedRepos ¶
func (r *RunStats) GetFileProvidedRepos() []*types.AllowedRepo
GetFileProvidedRepos returns a slice of the repos that were provided via the --repos flag (as opposed to looked up via the GitHub API via the --github-org flag)
func (*RunStats) GetMultiple ¶
func (r *RunStats) GetMultiple(event types.Event) []*github.Repository
GetMultiple returns the slice of pointers to GitHub repositories filed under the provided event's key
func (*RunStats) GetPullRequests ¶
GetPullRequests returns the inner representation of the pull requests that were opened during the lifecycle of a given run
func (*RunStats) GetRepos ¶
func (r *RunStats) GetRepos() map[types.Event][]*github.Repository
GetRepos returns the inner map of events to *github.Repositories that the RunStats maintains throughout the lifecycle of a given command run
func (*RunStats) GetSelectionMode ¶
GetSelectionMode returns the currently set repo selection method
func (*RunStats) GetSkippedArchivedRepos ¶
func (r *RunStats) GetSkippedArchivedRepos() map[types.Event][]*github.Repository
GetSkippedArchivedRepos returns the inner map of events to *github.Repositories that are excluded from the targeted repos list
func (*RunStats) GetTotalRunSeconds ¶
GetTotalRunSeconds returns the total time it took, in seconds, to run all the selected commands against all the targeted repos
func (*RunStats) PrintReport ¶
func (r *RunStats) PrintReport()
PrintReport renders to STDOUT a summary of each repo that was considered by this tool and what happened to it during processing
func (*RunStats) SetCommand ¶
SetCommand sets the user-supplied command to be run against the targeted repos
func (*RunStats) SetFileProvidedRepos ¶
func (r *RunStats) SetFileProvidedRepos(fileProvidedRepos []*types.AllowedRepo)
SetFileProvidedRepos sets the number of repos that were provided via file by the user on startup (as opposed to looked up via GitHub API via the --github-org flag)
func (*RunStats) SetRepoFlagProvidedRepos ¶
func (r *RunStats) SetRepoFlagProvidedRepos(repoFlagProvidedRepos []*types.AllowedRepo)
SetRepoFlagProvidedRepos sets the number of repos that were provided via a single or multiple invocations of the --repo flag
func (*RunStats) SetSelectionMode ¶
SetSelectionMode accepts a string representing the method by which repos were selected for this run - in order to print a human-legible description in the final report
func (*RunStats) SetSkipPullRequests ¶
SetSkipPullRequests tracks whether the user specified that pull requests should be skipped (in favor of committing and pushing directly to the specified branch)
func (*RunStats) TrackDraftPullRequest ¶
TrackDraftPullRequest stores the successful Draft PR opening for the supplied Repo, at the supplied PR URL This function is safe to call from concurrent goroutines
func (*RunStats) TrackMultiple ¶
func (r *RunStats) TrackMultiple(event types.Event, repos []*github.Repository)
TrackMultiple accepts a types.Event and a slice of pointers to GitHub repos that will all be associated with that event
func (*RunStats) TrackPullRequest ¶
TrackPullRequest stores the successful PR opening for the supplied Repo, at the supplied PR URL This function is safe to call from concurrent goroutines
func (*RunStats) TrackSingle ¶
func (r *RunStats) TrackSingle(event types.Event, repo *github.Repository)
TrackSingle accepts a types.Event to associate with the supplied repo so that a final report can be generated at the end of each run