Sign inSign up

microservices/github

By microservices

Updated almost 7 years ago

Image
1

779

microservices/github repository overview

GitHub Open Microservice

GitHub API, GraphQL, Webhook and Login Server

Open Microservice Specification Version Open Microservices Spectrum Chat Open Microservices Code of Conduct Open Microservices Commitzen PRs Welcome License: MIT

Introduction

This project is an example implementation of the Open Microservice Specification, a standard originally created at Storyscript for building highly-portable "microservices" that expose the events, actions, and APIs inside containerized software.

Getting Started

The oms command-line interface allows you to interact with Open Microservices. If you're interested in creating an Open Microservice the CLI also helps validate, test, and debug your oms.yml implementation!

See the oms-cli project to learn more!

Installation
npm install -g @microservices/oms

Usage

Open Microservices CLI Usage

Once you have the oms-cli installed, you can run any of the following commands from within this project's root directory:

Actions
api

Make an API request to the GitHub REST API

Action Arguments
Argument NameTypeRequiredDefaultDescription
methodenumfalseNoneNo description provided.
urlstringtrueNoneNo description provided.
datamapfalseNoneThe data to post in the API request body.
paramsmapfalseNoneNo description provided.
headersmapfalseNoneNo description provided.
tokenstringfalseNoneA oauth user access token to use during the request for authentication.
iidintfalseNoneThe GitHub App installation ID to use during authentication.
APP_IDintfalseNoneYour GitHub App ID
APP_PRIVATE_KEYstringfalseNoneYour GitHub App private key in PEM format
HOSTNAMEstringfalseNoneThe GitHub Hostname (for GitHub Enterprise)
API_HOSTNAMEstringfalseNoneThe GitHub API Hostname (for GitHub Enterprise) Default to "api.HOSTNAME"
CLIENT_IDstringfalseNoneThe GitHub Oauth Client ID
CLIENT_SECRETstringfalseNoneThe GitHub Oauth Client Secret
OAUTH_TOKENstringfalseNoneA user oauth token to be used if not provided during an action.
WEBHOOK_SECRETstringfalseNoneUsed to check the webhook payload signature.
USER_AGENTstringfalseNoneGitHub requires a the User-Agent header defined.
oms run api \ 
    -a method='*****' \ 
    -a url='*****' \ 
    -a data='*****' \ 
    -a params='*****' \ 
    -a headers='*****' \ 
    -a token='*****' \ 
    -a iid='*****' \ 
    -e APP_ID=$APP_ID \ 
    -e APP_PRIVATE_KEY=$APP_PRIVATE_KEY \ 
    -e HOSTNAME=$HOSTNAME \ 
    -e API_HOSTNAME=$API_HOSTNAME \ 
    -e CLIENT_ID=$CLIENT_ID \ 
    -e CLIENT_SECRET=$CLIENT_SECRET \ 
    -e OAUTH_TOKEN=$OAUTH_TOKEN \ 
    -e WEBHOOK_SECRET=$WEBHOOK_SECRET \ 
    -e USER_AGENT=$USER_AGENT
graphql

Query GitHub GraphQL

Action Arguments
Argument NameTypeRequiredDefaultDescription
querystringtrueNoneNo description provided.
headersmapfalseNoneNo description provided.
tokenstringfalseNoneA oauth user access token to use during the request for authentication.
iidintfalseNoneThe GitHub App installation ID to use during authentication.
APP_IDintfalseNoneYour GitHub App ID
APP_PRIVATE_KEYstringfalseNoneYour GitHub App private key in PEM format
HOSTNAMEstringfalseNoneThe GitHub Hostname (for GitHub Enterprise)
API_HOSTNAMEstringfalseNoneThe GitHub API Hostname (for GitHub Enterprise) Default to "api.HOSTNAME"
CLIENT_IDstringfalseNoneThe GitHub Oauth Client ID
CLIENT_SECRETstringfalseNoneThe GitHub Oauth Client Secret
OAUTH_TOKENstringfalseNoneA user oauth token to be used if not provided during an action.
WEBHOOK_SECRETstringfalseNoneUsed to check the webhook payload signature.
USER_AGENTstringfalseNoneGitHub requires a the User-Agent header defined.
oms run graphql \ 
    -a query='*****' \ 
    -a headers='*****' \ 
    -a token='*****' \ 
    -a iid='*****' \ 
    -e APP_ID=$APP_ID \ 
    -e APP_PRIVATE_KEY=$APP_PRIVATE_KEY \ 
    -e HOSTNAME=$HOSTNAME \ 
    -e API_HOSTNAME=$API_HOSTNAME \ 
    -e CLIENT_ID=$CLIENT_ID \ 
    -e CLIENT_SECRET=$CLIENT_SECRET \ 
    -e OAUTH_TOKEN=$OAUTH_TOKEN \ 
    -e WEBHOOK_SECRET=$WEBHOOK_SECRET \ 
    -e USER_AGENT=$USER_AGENT
webhooks
Action Arguments
Argument NameTypeRequiredDefaultDescription
eventslistfalseNoneList of events to listen too See https://developer.github.com/webhooks/#events for full list
APP_IDintfalseNoneYour GitHub App ID
APP_PRIVATE_KEYstringfalseNoneYour GitHub App private key in PEM format
HOSTNAMEstringfalseNoneThe GitHub Hostname (for GitHub Enterprise)
API_HOSTNAMEstringfalseNoneThe GitHub API Hostname (for GitHub Enterprise) Default to "api.HOSTNAME"
CLIENT_IDstringfalseNoneThe GitHub Oauth Client ID
CLIENT_SECRETstringfalseNoneThe GitHub Oauth Client Secret
OAUTH_TOKENstringfalseNoneA user oauth token to be used if not provided during an action.
WEBHOOK_SECRETstringfalseNoneUsed to check the webhook payload signature.
USER_AGENTstringfalseNoneGitHub requires a the User-Agent header defined.
oms subscribe webhooks \ 
    -a events='*****' \ 
    -e APP_ID=$APP_ID \ 
    -e APP_PRIVATE_KEY=$APP_PRIVATE_KEY \ 
    -e HOSTNAME=$HOSTNAME \ 
    -e API_HOSTNAME=$API_HOSTNAME \ 
    -e CLIENT_ID=$CLIENT_ID \ 
    -e CLIENT_SECRET=$CLIENT_SECRET \ 
    -e OAUTH_TOKEN=$OAUTH_TOKEN \ 
    -e WEBHOOK_SECRET=$WEBHOOK_SECRET \ 
    -e USER_AGENT=$USER_AGENT

Contributing

All suggestions in how to improve the specification and this guide are very welcome. Feel free share your thoughts in the Issue tracker, or even better, fork the repository to implement your own ideas and submit a pull request.

Edit github on CodeSandbox

This project is guided by Contributor Covenant. Please read out full Contribution Guidelines.

Additional Resources

Tag summary

Content type

Image

Digest

Size

366.7 MB

Last updated

almost 7 years ago

docker pull microservices/github