sync with upstream
This commit is contained in:
7
src/index.ts
Normal file
7
src/index.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
/**
|
||||
* The entrypoint for the action.
|
||||
*/
|
||||
import { run } from './main'
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
||||
run()
|
||||
@@ -92,7 +92,7 @@ function getDownloadUrl(version: string): string {
|
||||
* @returns the latest version
|
||||
*/
|
||||
async function getLatestVersion(): Promise<string> {
|
||||
const token = core.getInput('github-token', {required: true})
|
||||
const token = core.getInput('github-token', { required: true })
|
||||
const octokit = github.getOctokit(token)
|
||||
const response = await octokit.rest.repos.getLatestRelease({
|
||||
owner: 'aliyun',
|
||||
|
||||
@@ -2,7 +2,11 @@ import * as core from '@actions/core'
|
||||
import * as exec from '@actions/exec'
|
||||
import * as installer from './installer'
|
||||
|
||||
async function run(): Promise<void> {
|
||||
/**
|
||||
* The main function for the action.
|
||||
* @returns {Promise<void>} Resolves when the action is complete.
|
||||
*/
|
||||
export async function run(): Promise<void> {
|
||||
try {
|
||||
// download
|
||||
const version = core.getInput('ossutil-version')
|
||||
@@ -10,7 +14,7 @@ async function run(): Promise<void> {
|
||||
core.info('ossutil is successfully installed')
|
||||
|
||||
// config
|
||||
const inputOptions: core.InputOptions = {required: true}
|
||||
const inputOptions: core.InputOptions = { required: true }
|
||||
const endpoint = core.getInput('endpoint', inputOptions)
|
||||
const accessKeyId = core.getInput('access-key-id', inputOptions)
|
||||
const accessKeySecret = core.getInput('access-key-secret', inputOptions)
|
||||
@@ -32,10 +36,7 @@ async function run(): Promise<void> {
|
||||
core.info('ossutil config is done')
|
||||
}
|
||||
} catch (error) {
|
||||
if (error instanceof Error) {
|
||||
core.setFailed(error.message)
|
||||
}
|
||||
// Fail the workflow run if an error occurs
|
||||
if (error instanceof Error) core.setFailed(error.message)
|
||||
}
|
||||
}
|
||||
|
||||
run()
|
||||
Reference in New Issue
Block a user