11import { spawnSync } from 'child_process'
22import fs from 'fs'
33import path from 'path'
4- import core from '@actions/core'
5- import github from '@actions/github'
6- import { Octokit } from '@octokit/rest'
74
85export function runCommand ( commands : string [ ] , cwd ?: string ) {
96 return spawnSync ( commands [ 0 ] , commands . slice ( 1 ) , {
@@ -48,6 +45,7 @@ export async function buildSite() {
4845 // Bypass Jekyll
4946 runCommand ( [ 'touch' , '.nojekyll' ] , workSpace )
5047
48+ const core = await import ( '@actions/core' )
5149 const storageType = core . getInput ( 'storageType' )
5250 if ( storageType === 'files' ) process . env . NEXT_PUBLIC_STORAGE = 'files'
5351
@@ -63,6 +61,9 @@ export async function setup() {
6361 console . log ( 'Action: ' , process . env [ 'GITHUB_ACTION' ] )
6462 const workSpace = getWorkspacePath ( )
6563 if ( workSpace ) {
64+ const core = await import ( '@actions/core' )
65+ const github = await import ( '@actions/github' )
66+ const { Octokit } = await import ( '@octokit/rest' )
6667 const user = process . env [ 'GITHUB_ACTOR' ]
6768 const token = core . getInput ( 'token' , { required : true } )
6869 const branch = core . getInput ( 'branch' , { required : true } )
@@ -111,6 +112,8 @@ export async function setup() {
111112export async function publish ( ) {
112113 const workSpace = getWorkspacePath ( )
113114 if ( workSpace ) {
115+ const core = await import ( '@actions/core' )
116+ const github = await import ( '@actions/github' )
114117 const branch = core . getInput ( 'branch' , { required : true } )
115118 const token = core . getInput ( 'token' , { required : true } )
116119 const user = process . env [ 'GITHUB_ACTOR' ]
0 commit comments