pullreqs

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Fetch

func Fetch(c *gin.Context)

func GetLastID added in v0.0.5

func GetLastID(ctx context.Context, projectID, dsn, owner, repository string) (int64, error)

func GetLastPullReqsCommits added in v0.0.5

func GetLastPullReqsCommits(ctx context.Context, projectID, dsn, owner, repository string) (int64, error)

func ListPullReqs

func ListPullReqs(ctx context.Context, projectID, dsn, owner, repository, state, limit string) ([]dataset.PullReq, error)
Example
package main

import (
	"context"
	"fmt"
	"log"
	"os"

	"github.com/itsubaki/fourkeys/handler/pullreqs"
)

func main() {
	// https://github.com/itsubaki/fourkeys/pulls?q=is%3Apr+is%3Aclosed
	prs, err := pullreqs.ListPullReqs(context.Background(), os.Getenv("PROJECT_ID"), "fourkeys", "itsubaki", "fourkeys", "closed", "3")
	if err != nil {
		log.Fatalf("list pullreqs: %v", err)
	}

	for _, pr := range prs {
		fmt.Printf("%v %v %v\n", pr.ID, pr.Number, pr.State)
	}

}
Output:

955942047 1 closed
956961787 2 closed
971456366 4 closed

func Update

func Update(c *gin.Context)

func UpdatePullReq

func UpdatePullReq(ctx context.Context, projectID, dsn string, r *github.PullRequest) error
Example
package main

import (
	"context"
	"log"
	"os"
	"time"

	"github.com/google/go-github/v40/github"
	"github.com/itsubaki/fourkeys/handler/pullreqs"
)

func main() {
	if err := pullreqs.UpdatePullReq(context.Background(), os.Getenv("PROJECT_ID"), "fourkeys", &github.PullRequest{
		ID:       github.Int64(-1), // not exists. no effect.
		ClosedAt: &time.Time{},
	}); err != nil {
		log.Fatalf("update pullreq: %v", err)
	}

}

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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