Skip to content

Commit 9f28e1e

Browse files
committed
Move import to local function
1 parent 2b4dfe7 commit 9f28e1e

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

action/repository.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
import { spawnSync } from 'child_process'
22
import fs from 'fs'
33
import path from 'path'
4-
import core from '@actions/core'
5-
import github from '@actions/github'
6-
import { Octokit } from '@octokit/rest'
74

85
export 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() {
111112
export 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

Comments
 (0)