Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missed some special character in ENV #346

Closed
viettl opened this issue Nov 11, 2024 · 1 comment · Fixed by #351
Closed

Missed some special character in ENV #346

viettl opened this issue Nov 11, 2024 · 1 comment · Fixed by #351
Assignees
Labels
bug Something isn't working

Comments

@viettl
Copy link

viettl commented Nov 11, 2024

Describe the bug

In the process of retrieving variables from the Github environment, special characters such as $? are missing.

Example Yaml Config

    - name: Set Environment Variables
        run: |
          
            echo "HOST=${{ secrets.DEV_SERVER }}" >> $GITHUB_ENV
            echo "USER=${{ secrets.DEV_USER }}" >> $GITHUB_ENV
            echo "PASS=${{ secrets.DEV_PASS }}" >> $GITHUB_ENV
  
      - name: CI Server
        uses: appleboy/ssh-action@master
        with:
          host: ${{ env.HOST }}
          username: ${{ env.USER }}
          password: ${{ env.PASS }}

eg:
with DEV_PASS : 3HUS$?8kLu)}
will get: 3HUS8kLu)}

and the password is logged as plain text instead of *** in ci log. Thanks for your help.

@appleboy
Copy link
Owner

appleboy commented Dec 2, 2024

  testing07:
    name: some special character
    runs-on: ubuntu-latest
    steps:
      - name: checkout
        uses: actions/checkout@v4

      - name: Set Environment Variables
        run: |
          PASS='3HUS$?8kLu)}'
          printf "PASS=${PASS}" >> $GITHUB_ENV

      - name: create new ssh server
        run: |
          docker run -d \
          --name=openssh-server \
          --hostname=openssh-server \
          -p 2222:2222 \
          -e SUDO_ACCESS=false \
          -e PASSWORD_ACCESS=true  \
          -e USER_PASSWORD='${{ env.PASS }}'  \
          -e USER_NAME=linuxserver.io \
          --restart unless-stopped \
          lscr.io/linuxserver/openssh-server:latest
          docker exec openssh-server sh -c "hostname -i" > ip.txt
          echo "REMOTE_HOST<<EOF" >> $GITHUB_ENV
          cat ip.txt >> $GITHUB_ENV
          echo "EOF" >> $GITHUB_ENV
          echo "======= container ip address ========="
          cat ip.txt
          echo "======================================"
          sleep 2

      - name: ssh by username and password
        uses: ./
        with:
          host: ${{ env.REMOTE_HOST }}
          username: linuxserver.io
          password: ${{ env.PASS }}
          port: 2222
          script: |
            #!/usr/bin/env bash
            set -e
            whoami

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants