skip to Main Content

I am using the continuous deployment by GitHub actions for 1 year or more everything was okay until yesterday when I pushed my updates I found an error in GitHub actions with this message:

can’t connect without a private SSH key or password

This is my yml code

jobs:
  build:

    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v1

      - name: Copy repository contents via scp
        uses: appleboy/scp-action@master
        env:
          HOST: ${{ secrets.HOST }}
          USERNAME: ${{ secrets.USERNAME }}
          PORT: ${{ secrets.PORT }}
          KEY: ${{ secrets.SSHKEY }}
        with:
          source: "."
          target: "/home/ubuntu/dev-folder"

      - name: Executing remote command
        uses: appleboy/ssh-action@master
        with:
          host: ${{ secrets.HOST }}
          USERNAME: ${{ secrets.USERNAME }}
          PORT: ${{ secrets.PORT }}
          KEY: ${{ secrets.SSHKEY }}
          command_timeout: 10m
          script: cd dev-folder;
            mvn package install

I didn’t change anything in the yml file

Did GitHub change anything on its policy?

I searched and I didn’t find anything to solve my problem

2

Answers


  1. I’m not familiar with those two appleboy actions but taking a quick look at the projects, there was a recent release of their base docker image that changes how env vars are getting used:

    https://github.com/appleboy/drone-ssh/pull/252

    Modify the EnvVars slice to include INPUT_ prefix when needed

    Additionally, you’re using a very old / outdated version of the actions/checkout@v1

    I’d strongly recommend updating your config to handle the latest versions.

    Login or Signup to reply.
  2. I finally found the solution here: https://github.com/appleboy/scp-action/issues/113

    Change

            env:
              host: ${{ secrets.SSH_HOST }}
              username: ${{ secrets.SSH_USER }}
              key: ${{ secrets.SSH_KEY }}
              port: ${{ secrets.SSH_PORT}}
            with:
              source: '.'
              target: ${{ secrets.PATH }}
    

    to

            with:
              host: ${{ secrets.SSH_HOST }}
              username: ${{ secrets.SSH_USER }}
              key: ${{ secrets.SSH_KEY }}
              port: ${{ secrets.SSH_PORT}}
              source: '.'
              target: ${{ secrets.PATH }}
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search