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:
James Ives 2022-01-31 08:08:23 -05:00 committed by GitHub
parent cdd72ba2c4
commit 91d4e8f962
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 55 additions and 35 deletions

View File

@ -1,17 +1,15 @@
// https://github.com/microsoft/vscode-dev-containers/tree/master/containers/typescript-node
{
"name": "Node.js & TypeScript",
"build": {
"dockerfile": "Dockerfile",
"args": {
"VARIANT": "14"
}
},
"settings": {
"terminal.integrated.shell.linux": "/bin/bash"
},
"extensions": [
"dbaeumer.vscode-eslint"
],
"remoteUser": "node"
"name": "Node.js & TypeScript",
"build": {
"dockerfile": "Dockerfile",
"args": {
"VARIANT": "14"
}
},
"settings": {
"terminal.integrated.shell.linux": "/bin/bash"
},
"extensions": ["dbaeumer.vscode-eslint"],
"remoteUser": "node"
}

View File

@ -218,7 +218,7 @@ jobs:
integration-container,
integration-ssh,
integration-ssh-third-party-client,
integration-env,
integration-env
]
runs-on: ubuntu-latest
steps:

View File

@ -18,7 +18,7 @@ jobs:
file: 'README.md'
template: '<a href="https://github.com/{{{ login }}}"><img src="https://github.com/{{{ login }}}.png" width="50px" alt="{{{ login }}}" /></a>&nbsp;&nbsp;'
maximum: 9999
- name: Generate Sponsors 💖
uses: JamesIves/github-sponsors-readme-action@v1.0.8
with:
@ -28,7 +28,6 @@ jobs:
template: '<a href="https://github.com/{{{ login }}}"><img src="https://github.com/{{{ login }}}.png" width="80px" alt="{{{ login }}}" /></a>&nbsp;&nbsp;'
marker: 'premium'
- name: Deploy to GitHub Pages
uses: JamesIves/github-pages-deploy-action@v4.2.2
with:

View File

@ -3,7 +3,7 @@ name: Update Major Version Tag
on:
push:
tags:
- "v*"
- 'v*'
jobs:
update-majorver:

View File

@ -1 +1,2 @@
process.env.ACTIONS_STEP_DEBUG = 'false'
process.env.RUNNER_OS = 'Windows'

View File

@ -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', () => {

View File

@ -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.'
)
}
})

View File

@ -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(
`${
status === Status.FAILED
? 'Deployment failed! ❌'
: status === Status.SUCCESS
? 'Completed deployment successfully! ✅'
: 'There is nothing to commit. Exiting early… 📭'
}`
)
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)

View File

@ -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. ❗`
)
}