From fd8511c33bbfbb1650d09544a6965128547913fe Mon Sep 17 00:00:00 2001 From: Nick Alteen Date: Fri, 1 Sep 2023 14:10:18 -0400 Subject: [PATCH] Add output and logging to container --- Dockerfile | 12 ++++++++---- action.yml | 27 ++++++++++++++++++--------- entrypoint.sh | 11 ++++++++++- 3 files changed, 36 insertions(+), 14 deletions(-) diff --git a/Dockerfile b/Dockerfile index af66730..6b92e63 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,11 @@ -FROM alpine:3.10 +# Set the base image to use for subsequent instructions +FROM alpine:3.18 -COPY LICENSE README.md / +# Set the working directory inside the container +WORKDIR /usr/src -COPY entrypoint.sh /entrypoint.sh +# Copy any source file(s) required for the action +COPY entrypoint.sh . -ENTRYPOINT ["/entrypoint.sh"] +# Configure the container to be run as an executable +ENTRYPOINT ["/usr/src/entrypoint.sh"] diff --git a/action.yml b/action.yml index 008f0a9..c9603b1 100644 --- a/action.yml +++ b/action.yml @@ -1,12 +1,21 @@ -name: 'Container Action Template' -description: 'Get started with Container actions' -author: 'GitHub' +name: 'The name of your action here' +description: 'Provide a description here' +author: 'Your name or organization here' + +# Define your inputs here. inputs: - myInput: - description: 'Input to use' - default: 'world' + who-to-greet: + description: 'Your input description here' + required: true + default: 'World' + +# Define your outputs here. +outputs: + greeting: + description: 'Your output description here' + runs: - using: 'docker' - image: 'Dockerfile' + using: docker + image: Dockerfile args: - - ${{ inputs.myInput }} + - ${{ inputs.who-to-greet }} diff --git a/entrypoint.sh b/entrypoint.sh index 3b8cd2d..22c9865 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,3 +1,12 @@ #!/bin/sh -l -echo "hello $1" +# Use INPUT_ to get the value of an input +GREETING="Hello, $INPUT_WHO_TO_GREET!" + +# Use workflow commands to do things like set debug messages +echo "::notice file=entrypoint.sh,line=7::$GREETING" + +# Write outputs to the $GITHUB_OUTPUT file +echo "greeting=$GREETING" >> "$GITHUB_OUTPUT" + +exit 0