Skip to content

Commit

Permalink
Fix linting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
vstarostin committed Apr 1, 2024
1 parent 7173a2a commit 398c891
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 21 deletions.
2 changes: 1 addition & 1 deletion dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

30 changes: 15 additions & 15 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,21 +95,21 @@ export function saveDefaultConfigs (defaultConfigs: any[]): string[] {
}

export async function downloadStageConfig (server: string, apiURL: string, version: string, token: string, owner: string, repository: string): Promise<void> {
const stageConfigURL = await getEnterpriseConfigUrl(STAGE_CONFIG, apiURL, version, token, owner, repository)
if (stageConfigURL === '') {
throw new Error('Can\'t download stage config: failed to get URL!')
}
const piperPath = internalActionVariables.piperBinPath
if (piperPath === undefined) {
throw new Error('Can\'t download stage config: piperPath not defined!')
}
const flags: string[] = ['--useV1']
flags.push('--defaultsFile', stageConfigURL)
flags.push('--gitHubTokens', `${getHost(server)}:${token}`)
const piperExec = await executePiper('getDefaults', flags)
let config = JSON.parse(piperExec.output)
fs.writeFileSync(path.join(CONFIG_DIR, ENTERPRISE_STAGE_CONFIG_FILENAME), config.content)
const stageConfigURL = await getEnterpriseConfigUrl(STAGE_CONFIG, apiURL, version, token, owner, repository)
if (stageConfigURL === '') {
throw new Error('Can\'t download stage config: failed to get URL!')
}

const piperPath = internalActionVariables.piperBinPath
if (piperPath === undefined) {
throw new Error('Can\'t download stage config: piperPath not defined!')
}
const flags: string[] = ['--useV1']
flags.push('--defaultsFile', stageConfigURL)
flags.push('--gitHubTokens', `${getHost(server)}:${token}`)
const piperExec = await executePiper('getDefaults', flags)
const config = JSON.parse(piperExec.output)
fs.writeFileSync(path.join(CONFIG_DIR, ENTERPRISE_STAGE_CONFIG_FILENAME), config.content)
}

export async function createCheckIfStepActiveMaps (server: string, apiURL: string, version: string, token: string, owner: string, repository: string): Promise<void> {
Expand Down
4 changes: 2 additions & 2 deletions src/enterprise.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ export async function getEnterpriseConfigUrl (configType: string, apiURL: string
} else {
return ''
}

// get URL of defaults from the release (gh api, authenticated)
const [url] = await getReleaseAssetUrl(assetname, version, apiURL, token, owner, repository)
if (url !== '') return url
// fallback to get URL of defaults in the repository (unauthenticated)
return `${process.env.GITHUB_API_URL}/repos/${owner}/${repository}/contents/resources/${filename}`
}
}
4 changes: 2 additions & 2 deletions src/piper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ export async function run (): Promise<void> {
actionCfg.gitHubEnterpriseServer,
actionCfg.gitHubEnterpriseApi,
actionCfg.sapPiperVersion,
actionCfg.gitHubEnterpriseToken,
actionCfg.sapPiperOwner,
actionCfg.gitHubEnterpriseToken,
actionCfg.sapPiperOwner,
actionCfg.sapPiperRepo
)
}
Expand Down

0 comments on commit 398c891

Please sign in to comment.