skip to Main Content

I’m trying to use $GITHUB_OUTPUT instead of set-output.

I set up a simple GitHub Action with a docker file based on the official tutorial.

# Container image that runs your code
FROM alpine:latest

# Copies your code file from your action repository to the filesystem path `/` of the container
COPY entrypoint.sh /entrypoint.sh

# Code file to execute when the docker container starts up (`entrypoint.sh`)
ENTRYPOINT ["/entrypoint.sh"]

And the entrypoint.sh is

#!/bin/sh -l

time=$(date)
echo "time=$time" >> $GITHUB_OUTPUT

Executing this in a Self hosted Debian runner results into a

/entrypoint.sh: 4: cannot create : Directory nonexistent

Changing the $GITHUB_OUTPUT with the usual ::set-output works correctly.

Any idea on how to solve this?

2

Answers


  1. The deprecation of set-output was mentioned recently (oct. 2022)

    If you are using self-hosted runners make sure they are updated to version 2.297.0 or greater.

    So check first the version of your runner.

    Login or Signup to reply.
  2. Well, yes, the version of the runner is probably one issue.

    The other is that the environment variables defined in the shell that creates and runs the container that previously echo "::set-output..." do not have access to GITHUB_OUTPUT unless specifically configured to do so. Moreover, the paths within the container are not the same as that outside, so the path in $GITHUB_OUTPUT won’t be available anyway.

    The fastest workaround is to add >> $GITHUB_OUTPUT on the docker run command itself, ie. OUTSIDE of the container, and just echo content in there to stdout.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search