Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
G

go-scm

> 开发工具
Open source

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

196 stars0 likes2 views
WebsiteGitHub

About

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

go-scm

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

Getting Started

Create a GitHub client:

go
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:

go
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:

go
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:

go
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:

go
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:

go
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.

…

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:

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

Example code to get a list of issues:

go
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:

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

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

Useful links

Here are some useful links to providers API documentation:

  • Azure DevOps
  • Bitbucket cloud API
  • Bitbucket server/Stash API
  • Gitea API
  • Gitee API
  • Github API
  • Gitlab API
  • Gogs API

Release procedure

Run the changelog generator.

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

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.

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

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

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Gobitbucketbitbucket-servergiteagithub

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 18, 2026
Category开发工具
PricingOpen source

> Related tools

V
VS Code
流行的开源代码编辑器
G
Git
分布式版本控制系统
V
Vite
下一代前端构建工具