slash-webtask-github-sourcer
v1.1.1
Published
Make Slash Webtasks run code directly off GitHub
Downloads
7
Readme
slash-webtask-github-sourcer
Make Slash Webtasks run code directly off GitHub. This is done by making the webtask load the code from GitHub and evaluate it in webtask’s context.
Allows Slash Webtasks to be version-controlled and collaboratively edited.
Uses the GitHub Apps API, so it does not require a personal access token.
How to set up
Create a GitHub app.
For organizations: Go to your organization settings → Developer settings → GitHub Apps → New GitHub App
For personal account: Go to user settings → Developer settings → GitHub Apps → New GitHub App
Set up your GitHub App permissions as follows:
- Repository contents: Read-only
Generate and download a Private Key.
Note the App ID.
Install the app, granting access to the repository where the webtask code is stored.
Note the Installation ID which is in the URL.
Create a Slash webtask.
In Slack, run
/wt make hello
and click the resulting edit link.Copy the existing code as-is, and put it in your GitHub Repository. Example: hello.js
Put in this code, change things as required:
module.exports = require('slash-webtask-github-sourcer')({ owner: 'taskworld', repo: 'slash-webtask-github-sourcer', appId: 12345, installationId: 1234567, path: 'hello.js', })
Configure the webtask Secrets → Add Secret
- Secret key: GH_APP_PRIVATE_KEY_BASE64
- Secret value: (encode the Private Key using Base64 and paste it here)
Configure the webtask npm Modules → Add Module → Type in slash-webtask-github-sourcer.