Switch to a JavaScript action

This commit is contained in:
Harry Marr
2021-03-16 13:43:16 -04:00
parent 6961ad11d0
commit 84bc6682c5
4 changed files with 22 additions and 29 deletions
-15
View File
@@ -1,15 +0,0 @@
FROM alpine
LABEL "repository"="http://github.com/hmarr/debug-action"
LABEL "homepage"="http://github.com/hmarr/debug-action"
LABEL "maintainer"="Harry Marr <[email protected]>"
LABEL "com.github.actions.name"="Debug Action"
LABEL "com.github.actions.description"="Log the action's environment variables and event payload"
LABEL "com.github.actions.icon"="code"
LABEL "com.github.actions.color"="yellow"
RUN apk --no-cache add jq
ADD entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
+8
View File
@@ -0,0 +1,8 @@
name: 'Debug action'
description: "Log the action's environment variables and event payload"
branding:
icon: 'code'
color: 'yellow'
runs:
using: 'node12'
main: 'index.js'
-14
View File
@@ -1,14 +0,0 @@
#!/bin/sh
set -e
echo
echo "-- Environment variables ----------------------------------------------"
env
echo "-----------------------------------------------------------------------"
echo
echo "-- Event JSON ---------------------------------------------------------"
cat "$GITHUB_EVENT_PATH" | jq -M .
echo "-----------------------------------------------------------------------"
echo
+14
View File
@@ -0,0 +1,14 @@
const fs = require("fs");
// Output environment variables. Secrets are automatically masked.
console.log("::group::Environment variables")
for (const [key, value] of Object.entries(process.env).sort()) {
console.log(`${key}=${value}`);
}
console.log("::endgroup::")
// Output prettified event JSON.
console.log("::group::Event JSON")
const event = JSON.parse(fs.readFileSync(process.env["GITHUB_EVENT_PATH"]));
console.log(JSON.stringify(event, null, 2));
console.log("::endgroup::")