From 4e556732967b12b29b84f566b0eeac26be1cc9d8 Mon Sep 17 00:00:00 2001 From: Simon Schneegans Date: Sat, 15 Aug 2020 12:33:06 +0200 Subject: [PATCH] :wrench: Add some initial code --- index.js | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/index.js b/index.js index e44d81b..4da3bb8 100644 --- a/index.js +++ b/index.js @@ -2,14 +2,30 @@ const core = require('@actions/core'); const github = require('@actions/github'); try { - // `who-to-greet` input defined in action metadata file - const nameToGreet = core.getInput('who-to-greet'); - console.log(`Hello ${nameToGreet}!`); - const time = (new Date()).toTimeString(); - core.setOutput('time', time); - // Get the JSON webhook payload for the event that triggered the workflow - const payload = JSON.stringify(github.context.payload, undefined, 2) - console.log(`The event payload: ${payload}`); + const auth = core.getInput('auth'); + const gistId = core.getInput('gist-id'); + const badgeName = core.getInput('badge-name'); + + const label = core.getInput('label'); + const message = core.getInput('message'); + const labelColor = core.getInput('label-color'); + const color = core.getInput('color'); + + let description = {schemaVersion: 1, label: label, message: message}; + + if (labelColor != undefined) { + description.labelColor = labelColor; + } + + if (color != undefined) { + description.labelColor = color; + } + + let data = {files: {}}; + data.files[badgeName].content = JSON.stringify(description); + + console.log(JSON.stringify(data)); + } catch (error) { core.setFailed(error.message); } \ No newline at end of file