When using prebuilt image `uses: docker://...`, inputs not explicitly set in `with` aren't sent in docker run

Replicated here: test by codfish · Pull Request #1 · codfish/docker-action-issue · GitHub

GitHub sets $INPUT_X envvars for you based on the inputs set in your action.yml. If you provide default values in the action.yml and dont explicitly pass in an input in with, then the $INPUT_X envvar will get set to the default. If your action is a docker action, it’s built first and then run, and when it’s run, all of these $INPUT_X env vars get passed into the container as options like -e $INPUT_X.

The problem: when your action uses a prebuilt image, i.e. uses: docker://ghcr.io/codfish/docker-action-issue:latest, any inputs that aren’t explicitly sent in with, those input vars do NOT get passed into the docker container in the run command.

The following screenshot is both run commands. On the left is when your uses declaration points to a repo location, and GitHub has to build the image themselves. On the right is when you point to a prebuilt image.

Good one (Left): https://github.com/LeafLink/llf-web/pull/869/checks?check_run_id=2347949148#step:5:136
Bad one (Right): https://github.com/LeafLink/llf-web/pull/869/checks?check_run_id=2347949148#step:6:19

That behavior makes sense to me: If you directly use the Docker image, there is no action.yml file to be parsed, just the Docker image. In that case you need to set any defaults within the image (e.g. in a script that reads the inputs).

The example workflow runs aren’t accessible, though, I guess the repository is private?

Yea thats unfortunate but makes sense. first link was wrong but I updated, try again.

1 Like