1
0
mirror of synced 2026-01-07 00:01:39 -05:00

Move files out of script/ (#45454)

Co-authored-by: Peter Bengtsson <peterbe@github.com>
This commit is contained in:
Kevin Heis
2023-11-02 11:17:39 -07:00
committed by GitHub
parent 3ecf4082e3
commit 748d1e3e3d
86 changed files with 121 additions and 111 deletions

22
src/workflows/github.js Normal file
View File

@@ -0,0 +1,22 @@
#!/usr/bin/env node
import dotenv from 'dotenv'
import { Octokit } from '@octokit/rest'
if (!process.env.GITHUB_TOKEN) {
dotenv.config()
}
// this module needs to work in development, production, and GitHub Actions
//
// GITHUB_TOKEN comes from one of the following sources:
// 1. set in the .env file (development)
// 2. set as a Heroku config var (staging and production)
// 3. an installation token granted via GitHub Actions
const apiToken = process.env.GITHUB_TOKEN
// See https://github.com/octokit/rest.js/issues/1207
export default function github() {
return new Octokit({
auth: `token ${apiToken}`,
})
}