html mode

This commit is contained in:
Tim Ruffles
2019-12-20 12:31:00 +00:00
parent 552403eec3
commit ce6486363e
3 changed files with 13 additions and 3 deletions

View File

@@ -10,8 +10,8 @@ jobs:
- uses: actions/checkout@v2
- uses: ./
with:
format: txt
output: ./humans.txt
format: html
output: ./gh-pages/index.html
- uses: peaceiris/actions-gh-pages@v2
env:
ACTIONS_DEPLOY_KEY: ${{ secrets.ACTIONS_DEPLOY_KEY }}

View File

@@ -6,6 +6,7 @@ const chalk = require('chalk')
const formatters = {
txt: txtFormatter,
html: htmlFormatter,
json: jsonFormatter,
shell: (data, opts) => txtFormatter(data, { ...opts, colors: true}),
}
@@ -62,3 +63,12 @@ function mapColorRange(strings, base, total) {
return strings.map((n, i) => chalk.hsl(((i + base) / total) * 360, 100, 50)(n))
}
function htmlFormatter(data, opts) {
fs.writeSync(opts.output, `<!doctype html>
<meta charset='utf8' />
<title>Actions - humans.txt</title>
<body><pre>
`)
txtFormatter(data, opts)
fs.writeSync(opts.output, "</pre></body>")
}

View File

@@ -2,7 +2,7 @@ name: 'GitHub Actions humans.txt'
description: 'List out the humans who help feed and tend the robots of GitHub Actions'
inputs:
format:
description: 'How to output the people of actions - txt, json or ascii'
description: 'How to output the people of actions - txt, json, html or ascii'
default: 'ascii'
output:
description: 'Where to output the file - stdout otherwise'