@@ -69,51 +69,13 @@ jobs:
6969 - name : Install dependencies
7070 run : npm ci
7171
72- - name : Install one-off development-only dependencies
73- run : npm install --no-save --include=optional esm
74-
7572 - name : Undeploy
76- uses : actions/github-script@2b34a689ec86a68d8ab9478298f91d5401337b7d
7773 env :
7874 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
7975 HEROKU_API_TOKEN : ${{ secrets.HEROKU_API_TOKEN }}
80- with :
81- script : |
82- const { GITHUB_TOKEN, HEROKU_API_TOKEN } = process.env
83-
84- // Exit if GitHub Actions PAT is not found
85- if (!GITHUB_TOKEN) {
86- throw new Error('You must supply a GITHUB_TOKEN environment variable!')
87- }
88-
89- // Exit if Heroku API token is not found
90- if (!HEROKU_API_TOKEN) {
91- throw new Error('You must supply a HEROKU_API_TOKEN environment variable!')
92- }
93-
94- // Workaround to allow us to load ESM files with `require(...)`
95- const esm = require('esm')
96- require = esm({})
97-
98- const { default: getOctokit } = require('./script/helpers/github')
99- const { default: undeployFromStaging } = require('./script/deployment/undeploy-from-staging')
100-
101- // This helper uses the `GITHUB_TOKEN` implicitly!
102- // We're using our usual version of Octokit vs. the provided `github`
103- // instance to avoid versioning discrepancies.
104- const octokit = getOctokit()
105-
106- try {
107- await undeployFromStaging({
108- octokit,
109- pullRequest: context.payload.pull_request,
110- runId: context.runId
111- })
112- } catch (error) {
113- console.error(`Failed to undeploy from staging: ${error.message}`)
114- console.error(error)
115- throw error
116- }
76+ RUN_ID : ${{ github.run_id }}
77+ PR_URL : ${{ github.event.pull_request.html_url }}
78+ run : .github/actions-scripts/staging-undeploy.js
11779
11880 - if : ${{ always() }}
11981 name : Remove the label from the PR to unblock deployment
0 commit comments