Skip to content

Instantly share code, notes, and snippets.


Gregor Martynus gr2m

View GitHub Profile
gr2m / demo.gif
Last active Feb 24, 2021
Deno script which uses Octokit with the OAuth Device authentication strategy


git clone probot-1371
cd probot-1371
npm install

Then run

gr2m / github-action-cypress-against-now-deployment.yaml
Created Mar 2, 2020
Example GitHub Action workflow which runs Cypress using now's deployment for the current commit. See
View github-action-cypress-against-now-deployment.yaml
name: End-to-end tests
on: [push]
runs-on: ubuntu-latest
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
node-version: 12
gr2m /
Last active Oct 8, 2019
I found myself create new Octokit repositories all the time, due to its decomposable and extendable architecture. Here is how I do it for future reference. Ideally, this would all be automated using an `npm init octokit` script

Create new Octokit (JS) repository


  • repository name: action.js
  • description: GitHub API client for GitHub Actions
# create new folder and change into it
mkdir action.js
gr2m /
Last active Oct 9, 2019
Living document to make the Octokit JS libraries ( work with ECMAScript Modules, Common JS and modern browsers

My usecase: Universal JavaScript libraries for GitHub's APIs for Node.js and modern browsers.

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 for creating browser bundles and distributing them via their CDN. Example:

I use @pika/pack to create a ./pkg folder with multiple distributions right before publishing to npm. Example:

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

gr2m / worker.js
Created Aug 27, 2019
A Cloudflare worker to exchange an OAuth Web Flow code for an access token. Configure your CLIENT_ID and CLIENT_SECRET and you are all set.
View worker.js
addEventListener('fetch', event => {
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}`)
gr2m /
Last active Aug 16, 2019
This is a living document on JavaScript Octokit’s build setup using pika pack and semantic-release on GitHub Actions

Octokit.js build setup using @pika/pack

Install @pika/pack and build plugins

npm install --save-dev @pika/pack @pika/plugin-build-node @pika/plugin-build-web @pika/plugin-ts-standard-pkg



Local setup

git clone github-lock-issue-test
cd github-lock-issue-test
npm install
node github-lock-issue-test.js

Should log