mirror of
https://github.com/bcomnes/deploy-to-neocities.git
synced 2026-03-28 17:21:37 +00:00
Print file stats when things error.
This commit is contained in:
14
index.js
14
index.js
@@ -6,10 +6,12 @@ const ms = require('ms')
|
|||||||
const assert = require('webassert').default
|
const assert = require('webassert').default
|
||||||
const fsp = require('fs').promises
|
const fsp = require('fs').promises
|
||||||
|
|
||||||
|
let cleanup
|
||||||
|
|
||||||
async function doDeploy () {
|
async function doDeploy () {
|
||||||
const token = core.getInput('api_token')
|
const token = core.getInput('api_token')
|
||||||
const distDir = path.join(process.cwd(), core.getInput('dist_dir'))
|
const distDir = path.join(process.cwd(), core.getInput('dist_dir'))
|
||||||
const cleanup = JSON.parse(core.getInput('cleanup'))
|
cleanup = JSON.parse(core.getInput('cleanup'))
|
||||||
|
|
||||||
assert(typeof cleanup === 'boolean', 'Cleanup input must be a boolean "true" or "false"')
|
assert(typeof cleanup === 'boolean', 'Cleanup input must be a boolean "true" or "false"')
|
||||||
const stat = await fsp.stat(distDir)
|
const stat = await fsp.stat(distDir)
|
||||||
@@ -30,5 +32,15 @@ async function doDeploy () {
|
|||||||
|
|
||||||
doDeploy().catch(err => {
|
doDeploy().catch(err => {
|
||||||
console.error(err)
|
console.error(err)
|
||||||
|
if (err.stats) {
|
||||||
|
console.log('Files to upload: ')
|
||||||
|
console.dir(err.stats.filesToUpload, { colors: true, depth: 999 })
|
||||||
|
|
||||||
|
if (cleanup) {
|
||||||
|
console.log('Files to delete: ')
|
||||||
|
console.dir(err.stats.filesToDelete, { colors: true, depth: 999 })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
core.setFailed(err.message)
|
core.setFailed(err.message)
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -8,9 +8,9 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "1.2.6",
|
"@actions/core": "1.2.6",
|
||||||
"async-neocities": "1.1.6",
|
"async-neocities": "1.1.7",
|
||||||
"ms": "^2.1.2",
|
"ms": "2.1.2",
|
||||||
"webassert": "^3.0.2"
|
"webassert": "3.0.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"auto-changelog": "^2.0.0",
|
"auto-changelog": "^2.0.0",
|
||||||
|
|||||||
Reference in New Issue
Block a user