Skip to content

Commit

Permalink
feat: show if the pr is mergeable
Browse files Browse the repository at this point in the history
  • Loading branch information
cuotos committed Nov 29, 2024
1 parent 6183349 commit 5e646a0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ type PullRequest struct {
Base string
Link string
Draft bool
Mergeable bool
}

func init() {
Expand Down Expand Up @@ -170,6 +171,7 @@ func getPullRequests(client *github.Client, queryString string) ([]PullRequest,
Base: ghPullRequest.GetBase().GetRef(),
Link: issue.GetHTMLURL(),
Draft: ghPullRequest.GetDraft(),
Mergeable: *ghPullRequest.Mergeable,
}

allPrs = append(allPrs, pr)
Expand Down Expand Up @@ -227,7 +229,7 @@ func printOutput(prs []PullRequest, org, team string, addDraftsCol bool) error {
writer := tabwriter.NewWriter(os.Stdout, 0, 0, 1, ' ', 0)

// Add headers to the buffer {
headerBuf := bytes.NewBufferString("CreatedAt\tTitle\tAuthor\tHead (from)\tBase (into)\tLink")
headerBuf := bytes.NewBufferString("CreatedAt\tTitle\tAuthor\tHead (from)\tBase (into)\tMergeable\tLink")

if addDraftsCol {
headerBuf.WriteString("\tDraft")
Expand All @@ -239,7 +241,7 @@ func printOutput(prs []PullRequest, org, team string, addDraftsCol bool) error {

for _, pr := range prs {
issueBuf := bytes.NewBufferString("")
issueBuf.WriteString(fmt.Sprintf("%s\t%s\t%s\t%s\t%s\t%s", pr.CreatedAt.Format("2006-01-02"), pr.Title, pr.Author, pr.Head, pr.Base, pr.Link))
issueBuf.WriteString(fmt.Sprintf("%s\t%s\t%s\t%s\t%s\t%t\t%s", pr.CreatedAt.Format("2006-01-02"), pr.Title, pr.Author, pr.Head, pr.Base, pr.Mergeable, pr.Link))

if addDraftsCol {
issueBuf.WriteString(fmt.Sprintf("\t%t", pr.Draft))
Expand Down

0 comments on commit 5e646a0

Please sign in to comment.