Giter Club home page Giter Club logo

go-scm's Introduction

go-scm

A small library with minimal depenencies for working with Webhooks, Commits, Issues, Pull Requests, Comments, Reviews, Teams and more on multiple git provider:

Building

See the guide to prerequisites, building and running the code

Working on the code

Clone this repository and use go test...

git clone https://github.com/jenkins-x/go-scm.git
cd go-scm
go test ./...

Writing tests

There are lots of tests for each driver; using sample JSON that comes from the git provider together with the expected canonical JSON.

e.g. I added this test for ListTeams on github: https://github.com/jenkins-x/go-scm/blob/master/scm/driver/github/org_test.go#L83-116

you then add some real json from the git provider: https://github.com/jenkins-x/go-scm/blob/master/scm/driver/github/testdata/teams.json and provide the expected json: https://github.com/jenkins-x/go-scm/blob/master/scm/driver/github/testdata/teams.json.golden

Trying the client on a provider

There are a few little sample programs in scm/factory/examples which are individual binaries you can run from the command line or your IDE.

To test against a git provider of your choice try defining these environment variables:

  • GIT_KIND for the kind of git provider (e.g. github, bitbucketserver, gitlab etc)
  • GIT_SERVER for the URL of the server to communicate with
  • GIT_TOKEN for the git OAuth/private token to talk to the git server

Git API Reference docs

To help hack on the different drivers here's a list of docs which outline the git providers REST APIs

GitHub

Bitbucket Server

Bitbucket Cloud

Gitlab

Fake driver for testing

When testing the use of go-scm its really handy to use the fake provider which lets you populate the in memory resources inside the driver or query resources after a test has run.

client, data := fake.NewDefault()

Community

We have a kanban board of stuff to work on if you fancy contributing!

You can also find us on Slack at kubernetes.slack.com:

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.