tree: a8bd2bc9637a5e0ad8c866bb2ef587891a4d0a40 [path history] [tgz]
  1. src/
  2. deployment.yaml
  3. manifest.yaml
  4. README.md
tests/usecases/github/README.md

Using GitHub Package with wskdeploy

The GitHub usecase demonstrates how to build an OpenWhisk app to display github commit messages using wskdeploy.

OpenWhisk comes with a GitHub package which can be used to run GitHub APIs. For our app to display github commits, we need:

All you have to do is add your own credentials in deployment.yaml to deploy this app.

GitHubWebhookTrigger:
    inputs:
        username: <username>  # replace it with your GitHub username
        repository: <repo>    # replace it with your repo eg. apache/openwhisk-wskdeploy
        accessToken: <token>  # replace it with token which has access to the specified repo
        events: push          # push for commits

Step 1: Deploy

Deploy it using wskdeploy:

wskdeploy -m tests/usecases/github/manifest.yaml -d tests/usecases/github/deployment.yaml

Step 2: Verify

$ wsk package get GitHubCommits
$ wsk trigger get GitHubWebhookTrigger
$ wsk rule get rule-for-github-commits

Step 3: Run

Push a sample commit to your github repo and you will see print-github-commits is activated:

Activation: print-github-commits (28f)
[
    "2017-09-01T19:08:38.46838161Z  stdout: Display GitHub Commit Details for GitHub repo:  https://github.com/your-repo",
    "2017-09-01T19:08:38.468756344Z stdout: Bob Smith added code changes with commit message: Updating README to appear on openwhisk",
    "2017-09-01T19:08:38.46877569Z  stdout: Commit logs are:",
    ...
]