Home

Awesome

Github Integration Pack

Pack which allows integration with Github.

Configuration

Copy the example configuration in github.yaml.example to /opt/stackstorm/configs/github.yaml and edit as required.

It must contain:

Keep in mind that even though actions which operate on public repositories don't require an authentication token, you are still encouraged to supply one because unauthenticated requests have a very low rate limit.

Note : When modifying the configuration in /opt/stackstorm/configs/ please remember to tell StackStorm to load these new values by running st2ctl reload --register-configs

Obtaining an Authentication Token

To obtain an authentication token, follow the instructions on the Creating an access token for command-line use page.

Sensors

GithubRepositorySensor

This sensor monitors Github repository for activity and dispatches a trigger for each repository event.

Note that current default poll interval requires authentication because of GitHub rate-limiting for unauthenticated requests.

Currently supported event types:

Note : The sensor will only listen events for the github_type you chosen in config.yaml

github.repository_event trigger

Example trigger payload:

{
    "repository": "st2",
    "id": "2482918921",
    "type": "WatchEvent",
    "created_at": "2014-12-25T11:47:27.000000Z",
    "actor": {
        "bio": null,
        "name": null,
        "url": "https://api.github.com/users/odyss009",
        "id": 483157,
        "loaction": null,
        "email": "redacted"
    },
    "payload": {
        "action": "started"
    }
}

All the events contain repository, id, created_at, actor and payload attribute.

Value of the payload attribute depends on the event type. You can see a list of the available event types and their attributes on the Event Types & Payloads page.

Note: Similar thing can be achieved using Github webhooks in combination with StackStorm webhook handler.

Actions

Rules

github.deployment_event_webhook

To enable this rule, run the following on the CLI (with a valid ST2 auth token):

st2 rule enable github.deploy_pack_on_deployment_event

Then you should add a web hook in github sending deployment events to the following URL:

https://<st2-server>/api/v1/webhooks/github_deployment_event?st2-api-key=<ST2-API-KEY>

By default the enviroment is set to production, you can change this in your own github.yaml.

You can then create a deployment via ChatOps with the following command:

@hubot github deployment create me/my_st2_pack description Lets get the feature to production

Limitations