Skip to content

consider changing the Docker image to capture stdout #267

@fdiblen

Description

@fdiblen

Currently it is not possible to use the stdout of Docker image in a GitHub action. This would be useful if one wants to do some tests based on stdout but not only exit codes.

I was able to do that by making the changes below.

1- add `docker-entrypoint.sh`` to set action output variable

#!/bin/sh
set -e

echo "arguments: $@"
step_stdout=$(exec cffconvert "$@")
echo $step_stdout
echo "::set-output name=step_stdout::$step_stdout"

2- modify the Dockerfile to use entrypoint shell script

FROM python:3.9-alpine
RUN apk --no-cache add build-base
RUN python3 -m pip install cffconvert==2.0.0
WORKDIR /app
COPY ./docker-entrypoint.sh /app/
ENTRYPOINT ["/app/docker-entrypoint.sh"]

The changes I made in the GitHub action can be seen here:
https://github.com/citation-file-format/cffconvert-github-action/compare/livetest-stdout

You can see an job with stdout here:
https://github.com/citation-file-format/cffconvert-github-action/runs/4922731817?check_suite_focus=true

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions