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.
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
addEventListener('fetch', event => { | |
event.respondWith(handleRequest(event.request)) | |
}) | |
const CLIENT_ID = '<your client ID>' | |
const CLIENT_SECRET = '<your client Secret>' | |
async function handleRequest(request) { | |
if (request.method === 'GET') { | |
return new Response(`$ curl -XPOST -H'Content-Type: application/json' -d'{"code": "<your oauth code>"}' ${request.url}`) |
@pika/pack
npm install --save-dev @pika/pack @pika/plugin-build-node @pika/plugin-build-web @pika/plugin-ts-standard-pkg
git clone git@gist.github.com:48ad793b3fb7dbb59bcd696bbf75baee.git github-lock-issue-test
cd github-lock-issue-test
npm install
node github-lock-issue-test.js
Should log