All Projects → drone → go-scm

drone / go-scm

Licence: other
Package scm provides a unified interface to multiple source code management systems.

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to go-scm

froggit-go
Froggit-Go is a universal Go library, allowing to perform actions on VCS providers.
Stars: ✭ 19 (-83.76%)
Mutual labels:  github-enterprise, gitlab, bitbucket, bitbucket-server
Gigrator
Git repos migration tool which supports Github / Gitee / Gitlab / Gitea / Coding / Gogs / 腾讯工蜂.
Stars: ✭ 34 (-70.94%)
Mutual labels:  gitlab, gogs, gitea
Gitea
Git with a cup of tea, painless self-hosted git service
Stars: ✭ 27,320 (+23250.43%)
Mutual labels:  gitlab, gogs, gitea
Gitlink
A Jetbrains plugin that opens a local file under Git version control in its remote host using the default browser.
Stars: ✭ 101 (-13.68%)
Mutual labels:  gitlab, bitbucket, vcs
MigrateGitlabToGogs
Migrate repositories from Gitlab to Gogs or Gitea
Stars: ✭ 49 (-58.12%)
Mutual labels:  gitlab, gogs, gitea
Source Integration
Source control integration plugin framework for MantisBT, including support for Github, Gitlab, Bitbucket, Gitweb, Cgit, Subversion, Mercurial and more
Stars: ✭ 167 (+42.74%)
Mutual labels:  gitlab, bitbucket, vcs
myyearwithgit
代码仓库年终总结报告。
Stars: ✭ 176 (+50.43%)
Mutual labels:  gitlab, bitbucket
go-bitbucket-v1
Bitbucket-server API (v1.0) library for Golang.
Stars: ✭ 45 (-61.54%)
Mutual labels:  bitbucket, bitbucket-server
git-the-lines
A Discord bot that prints out the lines referenced in a GitHub, GitLab, or BitBucket snippet link
Stars: ✭ 37 (-68.38%)
Mutual labels:  gitlab, bitbucket
repobee
CLI tool for managing Git repositories on GitHub and GitLab in the context of education
Stars: ✭ 51 (-56.41%)
Mutual labels:  github-enterprise, gitlab
GitWebLinks
Copy links to files in their online Git repositories from inside Visual Studio Code and Visual Studio 2022.
Stars: ✭ 28 (-76.07%)
Mutual labels:  bitbucket, bitbucket-server
migrate bitbucket server to bitbucket cloud
Migrate Atlassian Bitbucket Server to Bitbucket Cloud
Stars: ✭ 13 (-88.89%)
Mutual labels:  bitbucket, bitbucket-server
gitcolombo
🧬 Extract and analyze contributors info from git repos
Stars: ✭ 55 (-52.99%)
Mutual labels:  gitlab, bitbucket
10-days-of-git-and-github
asabeneh.github.io/10-days-of-git-and-github/
Stars: ✭ 786 (+571.79%)
Mutual labels:  gitlab, bitbucket
ansible-role-gogs
DEPRECATED Ansible Role - Gogs: Go Git Service
Stars: ✭ 27 (-76.92%)
Mutual labels:  gogs, vcs
playwright-ci
☁️ Set up Playwright in CI
Stars: ✭ 27 (-76.92%)
Mutual labels:  gitlab, bitbucket
gitlab to gitea
Gitlab to Gitea migration script.
Stars: ✭ 54 (-53.85%)
Mutual labels:  gitlab, gitea
feater
Tool for rapid deployment of selected features of your web application to isolated testing or demo environments.
Stars: ✭ 27 (-76.92%)
Mutual labels:  gitlab, bitbucket
github-templates
Good templates for the issue, pull request, and contributing templates on GitHub, GitLab, and Bitbucket.
Stars: ✭ 65 (-44.44%)
Mutual labels:  gitlab, bitbucket
Git Auto Deploy
Deploy your GitHub, GitLab or Bitbucket projects automatically on Git push events or web hooks
Stars: ✭ 251 (+114.53%)
Mutual labels:  gitlab, bitbucket

go-scm

Go Doc

Package scm provides a unified interface to multiple source code management systems including GitHub, GitHub Enterprise, Bitbucket, Bitbucket Server, Gitea and Gogs.

Getting Started

Create a GitHub client:

package main

import (
	"github.com/drone/go-scm/scm"
	"github.com/drone/go-scm/scm/driver/github"
)

func main() {
	client := github.NewDefault()
}

Create a GitHub Enterprise client:

import (
	"github.com/drone/go-scm/scm"
	"github.com/drone/go-scm/scm/driver/github"
)

func main() {
    client, err := github.New("https://github.company.com/api/v3")
}

Create a Bitbucket client:

import (
	"github.com/drone/go-scm/scm"
	"github.com/drone/go-scm/scm/driver/bitbucket"
)

func main() {
    client, err := bitbucket.New()
}

Create a Bitbucket Server (Stash) client:

import (
	"github.com/drone/go-scm/scm"
	"github.com/drone/go-scm/scm/driver/stash"
)

func main() {
    client, err := stash.New("https://stash.company.com")
}

Create a Gitea client:

import (
	"github.com/drone/go-scm/scm"
	"github.com/drone/go-scm/scm/driver/gitea"
)

func main() {
    client, err := gitea.New("https://gitea.company.com")
}

Create a Gitee client:

import (
    "github.com/drone/go-scm/scm"
    "github.com/drone/go-scm/scm/driver/gitee"
)

func main() {
    client, err := gitee.New("https://gitee.com/api/v5")
}

Authentication

The scm client does not directly handle authentication. Instead, when creating a new client, provide an http.Client that can handle authentication for you. For convenience, this library includes oauth1 and oauth2 implementations that can be used to authenticate requests.

package main

import (
	"github.com/drone/go-scm/scm"
	"github.com/drone/go-scm/scm/driver/github"
	"github.com/drone/go-scm/scm/transport"
	"github.com/drone/go-scm/scm/transport/oauth2"
)

func main() {
	client := github.NewDefault()

	// provide a custom http.Client with a transport
	// that injects the oauth2 token.
	client.Client = &http.Client{
		Transport: &oauth2.Transport{
			Source: oauth2.StaticTokenSource(
				&scm.Token{
					Token: "ecf4c1f9869f59758e679ab54b4",
				},
			),
		},
	}

	// provide a custom http.Client with a transport
	// that injects the private GitLab token through
	// the PRIVATE_TOKEN header variable.
	client.Client = &http.Client{
		Transport: &transport.PrivateToken{
			Token: "ecf4c1f9869f59758e679ab54b4",
		},
	}
}

Usage

The scm client exposes dozens of endpoints for working with repositories, issues, comments, files and more. Please see the godocs to learn more.

Example code to get an issue:

issue, _, err := client.Issues.Find(ctx, "octocat/Hello-World", 1)

Example code to get a list of issues:

opts := scm.IssueListOptions{
	Page:   1,
	Size:   30,
	Open:   true,
	Closed: false,
}

issues, _, err := client.Issues.List(ctx, "octocat/Hello-World", opts)

Example code to create an issue comment:

in := &scm.CommentInput{
	Body: "Found a bug",
}

comment, _, err := client.Issues.CreateComment(ctx, "octocat/Hello-World", 1, in)

Release procedure

Run the changelog generator.

docker run -it --rm -v "$(pwd)":/usr/local/src/your-app githubchangeloggenerator/github-changelog-generator -u drone -p go-scm -t <secret github token>

You can generate a token by logging into your GitHub account and going to Settings -> Personal access tokens.

Next we tag the PR's with the fixes or enhancements labels. If the PR does not fufil the requirements, do not add a label.

Run the changelog generator again with the future version according to semver.

docker run -it --rm -v "$(pwd)":/usr/local/src/your-app githubchangeloggenerator/github-changelog-generator -u drone -p go-scm -t <secret token> --future-release v1.15.2

Create your pull request for the release. Get it merged then tag the release.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].