actions / runner

The Runner for GitHub Actions :rocket:
https://github.com/features/actions
MIT License
4.65k stars 896 forks source link

Support using a login shell along with the container step syntax #1560

Open umarcor opened 2 years ago

umarcor commented 2 years ago

Describe the enhancement

Support using a login shell along with the container step syntax.

Code Snippet

  # Produces an error
  Action_String:
    needs: Image
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2

    - uses: docker://ghcr.io/image
      with:
        args: bash -lec 'if [ "$DEMO_VAR" != "somevalue" ]; then echo "Error!"; exit 1; fi && echo "Bye!"'

  # Commands seem to be ignored, no output is produced
  Action_File:
    needs: Image
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2

    - run: |
        cat > symbiflow-examples-tests.sh <<'EOF'
        if [ "$DEMO_VAR" != "somevalue" ]; then echo "Error!"; exit 1; fi
        echo "Bye!"
        EOF

    - uses: docker://ghcr.io/image
      with:
        args: bash -le ./symbiflow-examples-tests.sh

  # Commands seem to be ignored, no output is produced
  Action_Shebang:
    needs: Image
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2

    - run: |
        cat > symbiflow-examples-tests.sh <<'EOF'
        #!/usr/bin/env -S bash -le
        if [ "$DEMO_VAR" != "somevalue" ]; then echo "Error!"; exit 1; fi
        echo "Bye!"
        EOF
        chmod +x symbiflow-examples-tests.sh

    - uses: docker://ghcr.io/image
      with:
        args: ./symbiflow-examples-tests.sh

Additional information

Equivalent use cases are successful if docker is executed directly in a run step, instead of using the uses: docker:// syntax. See:

Ref: #1530

TingluoHuang commented 2 years ago

@umarcor can you provide a small repro about the issue?

umarcor commented 2 years ago

@TingluoHuang just updated the comment above (I created the issue first in order to have a number).

Hmmm, interestingly, 2 of the 3 reduced examples are working. I simplified it too much... I will update.

umarcor commented 2 years ago

@TingluoHuang, see:

github-actions[bot] commented 4 months ago

This issue is stale because it has been open 365 days with no activity. Remove stale label or comment or this will be closed in 15 days.

umarcor commented 4 months ago

😕

LecrisUT commented 1 week ago

Have you ever found a workaround for this?