Skip to content
This repository was archived by the owner on Jan 10, 2024. It is now read-only.
/ blocks-platform Public archive

The main prototype for GitHub Blocks

License

Notifications You must be signed in to change notification settings

githubnext/blocks-platform

Folders and files

NameName
Last commit message
Last commit date

Latest commit

db575f9 Â· Jun 6, 2023
Dec 21, 2022
Mar 11, 2022
Mar 17, 2023
Dec 20, 2022
Mar 17, 2023
Feb 3, 2023
Dec 21, 2022
Jan 6, 2023
Nov 9, 2022
Nov 17, 2022
Dec 20, 2022
Dec 17, 2022
May 4, 2022
Nov 30, 2022
Oct 20, 2021
Nov 21, 2022
Jul 14, 2022
Oct 25, 2021
Mar 11, 2022
Jun 9, 2022
Nov 28, 2022
Oct 14, 2022
Dec 21, 2022
Oct 28, 2021
Feb 3, 2022
Nov 9, 2022
Oct 24, 2022
Dec 20, 2022
Oct 21, 2021
Dec 17, 2022
Nov 30, 2021
Jun 6, 2023

Repository files navigation

GitHub Blocks

📣 Read this if you're part of the team creating the GitHub Blocks projects.

This repo contains the source code for a prototype app that demos the GitHub Blocks project.

Developing locally

This app uses a GitHub App to authenticate users and access resources on GitHub, with help from the NextAuth package. You'll need to create a GitHub App app and provide the required environment variables in the .env.local file.

Visit Register new GitHub App to set up a new app and provide the following information in the form fields:

  • "GitHub App name": a name to uniquely identify your app
  • "Homepage URL": http://localhost:3000/
  • "Callback URL": http://localhost/api/auth/callback/github
  • "Request user authorization (OAuth) during installation": checked
  • "Webhook" / "Active": unchecked
  • "Repository permissions":
    • "Administration": Read-only
    • "Contents": Read and write
    • "Pull requests": Read and write
  • "Where can this GitHub App be installed?": Any account

After creating the app:

  • "Generate a new client secret" and copy it to .env.local (see below)
  • "Generate a private key" and copy it to .env.local (see below)

Now fill in .env.local as follows:

GITHUB_ID="..." # your app's "Client ID"
GITHUB_PRIVATE_KEY="""
-----BEGIN RSA PRIVATE KEY-----
...
-----END RSA PRIVATE KEY-----
""" # the contents of the private key file
GITHUB_SECRET="..." # your app's "Client secret"
GITHUB_APP_SLUG="..." # the last path segment of the "Public link"
NEXTAUTH_SECRET="secret"
NEXTAUTH_URL="http://localhost:3000"
NEXT_PUBLIC_FUNCTIONS_URL=https://next-waitlist.azurewebsites.net/
# if you're running the sandbox app locally
NEXT_PUBLIC_SANDBOX_DOMAIN=http://localhost:3001

To start working:

yarn      # install the deps
yarn dev  # start up the server

In the browser, you can choose the file on GitHub to view with url params:

owner  # the GitHub org
repo   # the GitHub repo
path   # the path to the file

Deploying to staging

Handled automatically by our GitHub action.

Our staging site is HERE.

Deploy to production

  1. Navigate to the azure project for githubnext-blocks/staging
  2. Click "Swap" button
  3. Then swap" again on the sidebar

Updating Stars List

Occasionally we'll need to update the list of GitHub Stars. To make this easier, I've added a script to package.json stars:update which fetches the list of stars from https://api-stars.github.com/ and writes them to a file on disk, stars.json.