mirror of
https://github.com/JamesIves/github-pages-deploy-action.git
synced 2023-12-15 20:03:39 +08:00
Part 1: Logging Improvements (#1022)
* Part 1 of Logging Improvements * Update util.test.ts * Update util.test.ts * Update util.test.ts * Update util.test.ts * Adjustments to tests * Update util.test.ts * Update util.ts
This commit is contained in:
parent
cdd72ba2c4
commit
91d4e8f962
@ -10,8 +10,6 @@
|
||||
"settings": {
|
||||
"terminal.integrated.shell.linux": "/bin/bash"
|
||||
},
|
||||
"extensions": [
|
||||
"dbaeumer.vscode-eslint"
|
||||
],
|
||||
"extensions": ["dbaeumer.vscode-eslint"],
|
||||
"remoteUser": "node"
|
||||
}
|
||||
|
2
.github/workflows/integration.yml
vendored
2
.github/workflows/integration.yml
vendored
@ -218,7 +218,7 @@ jobs:
|
||||
integration-container,
|
||||
integration-ssh,
|
||||
integration-ssh-third-party-client,
|
||||
integration-env,
|
||||
integration-env
|
||||
]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
|
1
.github/workflows/sponsors.yml
vendored
1
.github/workflows/sponsors.yml
vendored
@ -28,7 +28,6 @@ jobs:
|
||||
template: '<a href="https://github.com/{{{ login }}}"><img src="https://github.com/{{{ login }}}.png" width="80px" alt="{{{ login }}}" /></a> '
|
||||
marker: 'premium'
|
||||
|
||||
|
||||
- name: Deploy to GitHub Pages
|
||||
uses: JamesIves/github-pages-deploy-action@v4.2.2
|
||||
with:
|
||||
|
2
.github/workflows/version.yml
vendored
2
.github/workflows/version.yml
vendored
@ -3,7 +3,7 @@ name: Update Major Version Tag
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- "v*"
|
||||
- 'v*'
|
||||
|
||||
jobs:
|
||||
update-majorver:
|
||||
|
@ -1 +1,2 @@
|
||||
process.env.ACTIONS_STEP_DEBUG = 'false'
|
||||
process.env.RUNNER_OS = 'Windows'
|
||||
|
@ -3,6 +3,7 @@ process.env['INPUT_FOLDER'] = 'build'
|
||||
process.env['GITHUB_SHA'] = '123'
|
||||
process.env['INPUT_DEBUG'] = 'debug'
|
||||
process.env['GITHUB_REF_NAME'] = 'test'
|
||||
process.env['RUNNER_OS'] = 'Linux'
|
||||
|
||||
import '../src/main'
|
||||
import {action, TestFlag} from '../src/constants'
|
||||
@ -27,7 +28,8 @@ jest.mock('@actions/core', () => ({
|
||||
setOutput: jest.fn(),
|
||||
exportVariable: jest.fn(),
|
||||
isDebug: jest.fn(),
|
||||
info: jest.fn()
|
||||
info: jest.fn(),
|
||||
notice: jest.fn()
|
||||
}))
|
||||
|
||||
describe('main', () => {
|
||||
|
@ -224,7 +224,7 @@ describe('util', () => {
|
||||
checkParameters(action)
|
||||
} catch (e) {
|
||||
expect(e instanceof Error && e.message).toMatch(
|
||||
'No deployment token/method was provided. You must provide the action with either a Personal Access Token or the GitHub Token secret in order to deploy. If you wish to use an ssh deploy token then you must set SSH to true.'
|
||||
'No deployment token/method was provided. You must provide the action with either a Personal Access Token or the GitHub Token secret in order to deploy. For more details on how to use an ssh deploy key please refer to the documentation.'
|
||||
)
|
||||
}
|
||||
})
|
||||
@ -244,7 +244,7 @@ describe('util', () => {
|
||||
checkParameters(action)
|
||||
} catch (e) {
|
||||
expect(e instanceof Error && e.message).toMatch(
|
||||
'No deployment token/method was provided. You must provide the action with either a Personal Access Token or the GitHub Token secret in order to deploy. If you wish to use an ssh deploy token then you must set SSH to true.'
|
||||
'No deployment token/method was provided. You must provide the action with either a Personal Access Token or the GitHub Token secret in order to deploy. For more details on how to use an ssh deploy key please refer to the documentation.'
|
||||
)
|
||||
}
|
||||
})
|
||||
|
29
src/lib.ts
29
src/lib.ts
@ -1,4 +1,4 @@
|
||||
import {exportVariable, info, setFailed, setOutput} from '@actions/core'
|
||||
import {exportVariable, info, notice, setFailed, setOutput} from '@actions/core'
|
||||
import {ActionInterface, NodeActionInterface, Status} from './constants'
|
||||
import {deploy, init} from './git'
|
||||
import {configureSSH} from './ssh'
|
||||
@ -21,8 +21,25 @@ export default async function run(
|
||||
|
||||
try {
|
||||
info(`
|
||||
GitHub Pages Deploy Action 🚀
|
||||
╭━━━╮╭╮╭╮╱╭╮╱╱╭╮╱╱╭━━━╮
|
||||
┃╭━╮┣╯╰┫┃╱┃┃╱╱┃┃╱╱┃╭━╮┃
|
||||
┃┃╱╰╋╮╭┫╰━╯┣╮╭┫╰━╮┃╰━╯┣━━┳━━┳━━┳━━╮
|
||||
┃┃╭━╋┫┃┃╭━╮┃┃┃┃╭╮┃┃╭━━┫╭╮┃╭╮┃┃━┫━━┫
|
||||
┃╰┻━┃┃╰┫┃╱┃┃╰╯┃╰╯┃┃┃╱╱┃╭╮┃╰╯┃┃━╋━━┃
|
||||
╰━━━┻┻━┻╯╱╰┻━━┻━━╯╰╯╱╱╰╯╰┻━╮┣━━┻━━╯
|
||||
╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╭━╯┃
|
||||
╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╰━━╯
|
||||
╭━━━╮╱╱╱╱╱╭╮╱╱╱╱╱╱╱╱╭━━━╮╱╱╭╮
|
||||
╰╮╭╮┃╱╱╱╱╱┃┃╱╱╱╱╱╱╱╱┃╭━╮┃╱╭╯╰╮
|
||||
╱┃┃┃┣━━┳━━┫┃╭━━┳╮╱╭╮┃┃╱┃┣━┻╮╭╋┳━━┳━╮
|
||||
╱┃┃┃┃┃━┫╭╮┃┃┃╭╮┃┃╱┃┃┃╰━╯┃╭━┫┃┣┫╭╮┃╭╮╮
|
||||
╭╯╰╯┃┃━┫╰╯┃╰┫╰╯┃╰━╯┃┃╭━╮┃╰━┫╰┫┃╰╯┃┃┃┃
|
||||
╰━━━┻━━┫╭━┻━┻━━┻━╮╭╯╰╯╱╰┻━━┻━┻┻━━┻╯╰╯
|
||||
╱╱╱╱╱╱╱┃┃╱╱╱╱╱╱╭━╯┃
|
||||
╱╱╱╱╱╱╱╰╯╱╱╱╱╱╱╰━━╯
|
||||
`)
|
||||
|
||||
info(`
|
||||
💖 Support: https://github.com/sponsors/JamesIves
|
||||
📣 Maintained by James Ives: https://jamesiv.es
|
||||
|
||||
@ -53,17 +70,19 @@ export default async function run(
|
||||
status = await deploy(settings)
|
||||
} catch (error) {
|
||||
status = Status.FAILED
|
||||
|
||||
setFailed(extractErrorMessage(error))
|
||||
} finally {
|
||||
info(
|
||||
`${
|
||||
const terminationMessage = `${
|
||||
status === Status.FAILED
|
||||
? 'Deployment failed! ❌'
|
||||
: status === Status.SUCCESS
|
||||
? 'Completed deployment successfully! ✅'
|
||||
: 'There is nothing to commit. Exiting early… 📭'
|
||||
}`
|
||||
)
|
||||
|
||||
info(terminationMessage)
|
||||
notice(terminationMessage)
|
||||
|
||||
exportVariable('deployment_status', status)
|
||||
setOutput('deployment-status', status)
|
||||
|
@ -1,4 +1,4 @@
|
||||
import {isDebug, info} from '@actions/core'
|
||||
import {isDebug, warning} from '@actions/core'
|
||||
import {existsSync} from 'fs'
|
||||
import path from 'path'
|
||||
import {
|
||||
@ -47,6 +47,7 @@ const hasRequiredParameters = <K extends keyof RequiredActionParameters>(
|
||||
const nonNullParams = params.filter(
|
||||
param => !isNullOrUndefined(action[param])
|
||||
)
|
||||
|
||||
return Boolean(nonNullParams.length)
|
||||
}
|
||||
|
||||
@ -54,7 +55,7 @@ const hasRequiredParameters = <K extends keyof RequiredActionParameters>(
|
||||
export const checkParameters = (action: ActionInterface): void => {
|
||||
if (!hasRequiredParameters(action, ['token', 'sshKey'])) {
|
||||
throw new Error(
|
||||
'No deployment token/method was provided. You must provide the action with either a Personal Access Token or the GitHub Token secret in order to deploy. If you wish to use an ssh deploy token then you must set SSH to true.'
|
||||
'No deployment token/method was provided. You must provide the action with either a Personal Access Token or the GitHub Token secret in order to deploy. For more details on how to use an ssh deploy key please refer to the documentation.'
|
||||
)
|
||||
}
|
||||
|
||||
@ -77,7 +78,7 @@ export const checkParameters = (action: ActionInterface): void => {
|
||||
process.env.RUNNER_OS as OperatingSystems
|
||||
)
|
||||
) {
|
||||
info(
|
||||
warning(
|
||||
`The operating system you're using is not supported and results may be varied. Please refer to the documentation for more details. ❗`
|
||||
)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user