Skip to content

runCmd exit code is ignored #294

@choopm

Description

@choopm

I noticed a bug when using the action like this:

- name: Build and run dev container task
  uses: devcontainers/ci@v0.3
  with:
    imageName: ghcr.io/${{ github.repository }}-devcontainer
    cacheFrom: ghcr.io/${{ github.repository }}-devcontainer
    push: always
    runCmd: |
      echo foo
      false
      echo bar

Exit codes will be ignored and thus commands after any failed one will still be executed.
There is no option to get the actual exit code afterwards.

🚀 Run command in container
  About to run devcontainer exec --workspace-folder /home/runner/work/xxx/xxx --remote-env GITHUB_OUTPUT=/mnt/github/output --remote-env GITHUB_ENV=/mnt/github/env --remote-env GITHUB_PATH=/mnt/github/path --remote-env GITHUB_STEP_SUMMARY=/mnt/github/step-summary bash -c echo foo
  false
  echo bar
  foo
  bar

This is caused by these lines of code:

It seems this can be fixed by switching from getExecOutput() to exec() according to actions/toolkit#1615

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