* Make a dedicated, fast, workflow just for docs-internal only Part of #1297 * make staging-build-pr only for github/docs * prune later * make it louder and clearer about disabling workflows * does it merge? * typo * rename ref * rename * early access should be good to go * far from perfect * start with that * gzip * rearrange * html_url * correction of actions/checkout sha * correction of actions/setup-node sha * quote * ooops * actually deploy * move @octokit/rest to dependencies * await-sleep hack * reinstall npm * typo * CONTEXT_NAME * deployments:write permission * pull-requests:read permission * actions:read and statuses:write permissions * private repo mention exception * it's called github.run_id * Apply suggestions from code review Co-authored-by: James M. Greene <JamesMGreene@github.com> * make CONTEXT_NAME optional (if it works) * comment out CONTEXT_NAME * simplifying * going to run on on.pull_request instead * remove comment * only the 2-phase staging deploy on github/docs * better if statement on label check * refactor of staging-deploy script * switch to npm install to get the deDependencies back * using --only=dev * updating comments * event_name * not on pushes to main * add staging-commit-status-success * testing testing * fix linting error * Remove other docs-internal references from staging-deploy-pr.yml * Cleaning up new staging-commit-status-success script and usage * Remove unnecessary environment refs * Remove unnecessary fallback Since the only event trigger is pull_request now instead of also push * Remove unnecessary env vars from workflow * docs-internal or docs but not both * Don't provide unnecessary environment refs * remove now moot exception * setting it to pull_request_target Co-authored-by: James M. Greene <JamesMGreene@github.com>
37 lines
921 B
JavaScript
Executable File
37 lines
921 B
JavaScript
Executable File
#!/usr/bin/env node
|
|
|
|
import getOctokit from '../../script/helpers/github.js'
|
|
|
|
const { GITHUB_TOKEN } = process.env
|
|
|
|
// Exit if GitHub Actions PAT is not found
|
|
if (!GITHUB_TOKEN) {
|
|
throw new Error('You must supply a GITHUB_TOKEN environment variable!')
|
|
}
|
|
|
|
// This helper uses the `GITHUB_TOKEN` implicitly!
|
|
// We're using our usual version of Octokit vs. the provided `github`
|
|
// instance to avoid versioning discrepancies.
|
|
const octokit = getOctokit()
|
|
|
|
const { CONTEXT_NAME, ACTIONS_RUN_LOG, HEAD_SHA } = process.env
|
|
if (!CONTEXT_NAME) {
|
|
throw new Error('$CONTEXT_NAME not set')
|
|
}
|
|
if (!ACTIONS_RUN_LOG) {
|
|
throw new Error('$ACTIONS_RUN_LOG not set')
|
|
}
|
|
if (!HEAD_SHA) {
|
|
throw new Error('$HEAD_SHA not set')
|
|
}
|
|
|
|
await octokit.repos.createCommitStatus({
|
|
owner,
|
|
repo,
|
|
sha: HEAD_SHA,
|
|
context: CONTEXT_NAME,
|
|
state: 'success',
|
|
description: 'Successfully deployed! See logs.',
|
|
target_url: ACTIONS_RUN_LOG,
|
|
})
|