Update
The difference between local and play environment is strictNullChecks
. It's set to false by default locally, but is enabled on the playground by default.
// Menu: Create gist from clipboard | |
// Description: Creates a new GitHub Gist with the contents of your current clipboard | |
// Author: Gregor Martynus | |
// Twitter: @gr2m | |
// https://github.com/gr2m/scriptkit-octokit/ | |
const { Octokit } = await npm("scriptkit-octokit"); | |
const octokit = new Octokit({ | |
auth: { | |
scopes: ["gist"], |
// Menu: Set GitHub Status with Octokit | |
// Description: Sets the status text on your GitHub Profile | |
const { Octokit } = await npm("scriptkit-octokit"); | |
const octokit = new Octokit({ | |
auth: { | |
scopes: ["user"], | |
env: "GITHUB_TOKEN_SET_USER_PROFILE", | |
}, | |
}); |
//Shortcut: command shift - | |
// Menu: Set GitHub Status | |
// Description: Sets the status text on your GitHub Profile | |
const message = await arg("What would you like to say?"); | |
const token = await env("GITHUB_STATUS_TOKEN", { | |
secret: true, | |
ignoreBlur: true, | |
hint: md( | |
`Create a token [on GitHub](https://github.com/settings/tokens/new?scopes=user&description=kit%20script)` |
// Menu: Copy GitHub user name | |
// Description: Copies a GitHub user's first name, fallback to @login | |
// Author: Gregor Martynus | |
// Twitter: @gr2m | |
const { Octokit } = await npm("octokit"); | |
const { createOAuthDeviceAuth } = await npm("@octokit/auth-oauth-device"); | |
// set GitHub Token unless it's already set |
The difference between local and play environment is strictNullChecks
. It's set to false by default locally, but is enabled on the playground by default.
Setup
git clone https://gist.github.com/08a749b9eb98ba73e83184894d78675c.git probot-1371
cd probot-1371
npm install
Then run
name: End-to-end tests | |
on: [push] | |
jobs: | |
cypress-run: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v1 | |
- uses: actions/setup-node@v1 | |
with: | |
node-version: 12 |
Example
action.js
GitHub API client for GitHub Actions
# create new folder and change into it
mkdir action.js
All libraries are written in Typescript, so a build step is necessary which makes it easier to seperate the source code structure from the distribution code structure. I rely heavily on pika.dev for creating browser bundles and distributing them via their CDN. Example: https://github.com/octokit/request.js/#usage.
I use @pika/pack
to create a ./pkg
folder with multiple distributions right before publishing to npm. Example: https://unpkg.com/browse/@octokit/request@5.1.0/
Currently, the dist-web/
folder is the ECMAScript Module export, it's referenced using the "module"
key in its package.json. The dist-node/
folder is referenced using the "main"
key in its package.json.
Besides the differentiation of common