Documentation
¶
Overview ¶
Package metadata exports the parts of GitHub that live outside git (issues, pull requests, releases, settings, projects, ...) as JSON files next to the repos.
Index ¶
- Constants
- Variables
- func AssetPath(metaDir string, release *gh.RepositoryRelease, asset *gh.ReleaseAsset) string
- func OwnerDir(target, login string) string
- func RepoDir(target, owner, repo string) string
- type Discussion
- type DiscussionComment
- type Exporter
- type IssueExport
- type Project
- type PullExport
- type Report
Constants ¶
const ( IssuesFile = "issues.json" PullsFile = "pulls.json" ReleasesFile = "releases.json" RulesetsFile = "rulesets.json" )
Files written per repo; verify reads the issue and pull counts back
Variables ¶
var ( OrgFiles = []string{"org.json", "actions-variables.json", "actions-secrets.json", "members.json", "teams.json", "projects-v2.json", RulesetsFile} UserFiles = []string{"projects-v2.json"} )
OrgFiles and UserFiles are the files an org or user export writes; verify checks them
Functions ¶
func AssetPath ¶
func AssetPath(metaDir string, release *gh.RepositoryRelease, asset *gh.ReleaseAsset) string
AssetPath returns where a release asset is stored under a repo's metadata dir
Types ¶
type Discussion ¶
type Discussion struct {
ID string `json:"id"`
Number int `json:"number"`
Title string `json:"title"`
Body string `json:"body"`
URL string `json:"url"`
CreatedAt string `json:"createdAt"`
UpdatedAt string `json:"updatedAt"`
Closed bool `json:"closed"`
Locked bool `json:"locked"`
Author json.RawMessage `json:"author"`
Category json.RawMessage `json:"category"`
Labels json.RawMessage `json:"labels"`
Comments connection[DiscussionComment] `json:"comments"`
}
Discussion is a repo discussion with all its comments and replies
type DiscussionComment ¶
type DiscussionComment struct {
ID string `json:"id"`
Body string `json:"body"`
URL string `json:"url"`
CreatedAt string `json:"createdAt"`
UpdatedAt string `json:"updatedAt"`
IsAnswer bool `json:"isAnswer"`
Author json.RawMessage `json:"author"`
Replies connection[json.RawMessage] `json:"replies"`
}
DiscussionComment is a top-level discussion comment with its replies
type Exporter ¶
type Exporter struct {
// Verbose prints each file as it is written
Verbose bool
// contains filtered or unexported fields
}
Exporter writes metadata JSON files under a target directory
func New ¶
New returns an Exporter. download fetches release assets from the storage host GitHub redirects to, so it must not carry the token.
func (*Exporter) ExportOrg ¶
ExportOrg writes an org's settings, Actions variables, secret names, members, teams, projects and rulesets into <target>/<org>.meta
func (*Exporter) ExportRepo ¶
ExportRepo writes all metadata of one repo into <target>/<owner>/<repo>.meta
type IssueExport ¶
type IssueExport struct {
Issue *gh.Issue `json:"issue"`
Comments []*gh.IssueComment `json:"comments"`
}
IssueExport is an issue with its comments
type Project ¶
type Project struct {
ID string `json:"id"`
Number int `json:"number"`
Title string `json:"title"`
ShortDescription string `json:"shortDescription"`
Readme string `json:"readme"`
URL string `json:"url"`
Public bool `json:"public"`
Closed bool `json:"closed"`
CreatedAt string `json:"createdAt"`
UpdatedAt string `json:"updatedAt"`
Fields connection[json.RawMessage] `json:"fields"`
Items []json.RawMessage `json:"items"`
}
Project is a Projects (v2) board with its fields and every item
type PullExport ¶
type PullExport struct {
Pull *gh.PullRequest `json:"pull"`
Comments []*gh.IssueComment `json:"comments"`
ReviewComments []*gh.PullRequestComment `json:"review_comments"`
Reviews []*gh.PullRequestReview `json:"reviews"`
}
PullExport is a pull request with its conversation, review comments and reviews
type Report ¶
type Report struct {
// Exported names every repo, org or user whose metadata was written
Exported []string
// Warnings are parts skipped because the token lacks a scope or access
Warnings []string
// Failed holds real failures, keyed by repo, org or user
Failed map[string]error
}
Report collects what an export did