6767 BUILD_ACTIONS_RUN_ID : ${{ env.BUILD_ACTIONS_RUN_ID }}
6868 with :
6969 script : |
70+
71+ // Curious about what version of node you get
72+ console.log('Node version:', process.version)
73+
7074 // In order to find out the PR info for a forked repo, we must query
7175 // the API for more info based on the originating workflow run
7276 const { BUILD_ACTIONS_RUN_ID } = process.env
@@ -482,12 +486,8 @@ jobs:
482486 - name : Install dependencies
483487 run : npm ci
484488
485- - name : Install one-off development-only dependencies
486- run : npm install --no-save --include=optional esm
487-
488489 - name : Deploy
489490 id : deploy
490- uses : actions/github-script@2b34a689ec86a68d8ab9478298f91d5401337b7d
491491 env :
492492 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
493493 HEROKU_API_TOKEN : ${{ secrets.HEROKU_API_TOKEN }}
@@ -499,69 +499,8 @@ jobs:
499499 ACTIONS_RUN_LOG : ${{ env.ACTIONS_RUN_LOG }}
500500 HEAD_SHA : ${{ needs.pr-metadata.outputs.head_sha }}
501501 ALLOWED_POLLING_FAILURES_PER_PHASE : ' 15'
502- with :
503- script : |
504- const { GITHUB_TOKEN, HEROKU_API_TOKEN } = process.env
505-
506- // Exit if GitHub Actions PAT is not found
507- if (!GITHUB_TOKEN) {
508- throw new Error('You must supply a GITHUB_TOKEN environment variable!')
509- }
510-
511- // Exit if Heroku API token is not found
512- if (!HEROKU_API_TOKEN) {
513- throw new Error('You must supply a HEROKU_API_TOKEN environment variable!')
514- }
515-
516- // Workaround to allow us to load ESM files with `require(...)`
517- const esm = require('esm')
518- require = esm({})
519-
520- const { default: parsePrUrl } = require('./script/deployment/parse-pr-url')
521- const { default: getOctokit } = require('./script/helpers/github')
522- const { default: deployToStaging } = require('./script/deployment/deploy-to-staging')
523-
524- // This helper uses the `GITHUB_TOKEN` implicitly!
525- // We're using our usual version of Octokit vs. the provided `github`
526- // instance to avoid versioning discrepancies.
527- const octokit = getOctokit()
528-
529- try {
530- const { PR_URL, SOURCE_BLOB_URL, CONTEXT_NAME, ACTIONS_RUN_LOG, HEAD_SHA } = process.env
531- const { owner, repo, pullNumber } = parsePrUrl(PR_URL)
532- if (!owner || !repo || !pullNumber) {
533- throw new Error(`'pullRequestUrl' input must match URL format 'https://github.com/github/(docs|docs-internal)/pull/123' but was '${PR_URL}'`)
534- }
535-
536- const { data: pullRequest } = await octokit.pulls.get({
537- owner,
538- repo,
539- pull_number: pullNumber
540- })
541-
542- await deployToStaging({
543- octokit,
544- pullRequest,
545- forceRebuild: false,
546- // These parameters will ONLY be set by Actions
547- sourceBlobUrl: SOURCE_BLOB_URL,
548- runId: context.runId
549- })
550-
551- await github.repos.createCommitStatus({
552- owner,
553- repo,
554- sha: HEAD_SHA,
555- context: CONTEXT_NAME,
556- state: 'success',
557- description: 'Successfully deployed! See logs.',
558- target_url: ACTIONS_RUN_LOG
559- })
560- } catch (error) {
561- console.error(`Failed to deploy to staging: ${error.message}`)
562- console.error(error)
563- throw error
564- }
502+ RUN_ID : ${{ github.run_id }}
503+ run : .github/actions-scripts/staging-deploy.js
565504
566505 - name : Mark the deployment as inactive if timed out
567506 uses : actions/github-script@2b34a689ec86a68d8ab9478298f91d5401337b7d
0 commit comments