GitHub Actions工作流错误:运行命令超时!即使脚本运行正常

11
我希望每次将新的代码提交到仓库后,都能够将我的Nuxt.js应用程序部署到远程服务器上。 以下是我的deploy.yml文件:
name: 'Deployment'

on:
  push:
    branches: ['master']

jobs:
  deploy:
    name: Deploy
    runs-on: ubuntu-latest
    steps:
    - name: Connect to SSH
      uses: appleboy/ssh-action@master
      with:
        host: webhostgb.com
        username: root
        key: ${{ secrets.PRIVATE_KEY }}
        port: 22
        script: |
          cd whgb-new
          git pull origin master
          npm run build
          fuser -kn tcp 3000
          pm2 restart deploy.sh

基本上deploy.sh运行npm start命令,但是我使用pm2创建另一个进程来执行部署,而不是在GitHub actions进程中进行部署

10分钟后我会收到此错误消息,即使它执行得很好:

err: 4bc06ed9a5a0b2fa431a.js   4.77 KiB      14  [emitted] [immutable]  pages/products/tags/_slug
err: 7bf498872cde31ceb6dd.js   13.3 KiB       7  [emitted] [immutable]  pages/docs/_slug/index
err: 8992f5bd049ebae3c980.js   15.6 KiB       8  [emitted] [immutable]  pages/docs/categories/_slug
err: 8e455a3b7f57d2d0fa08.js   4.53 KiB      13  [emitted] [immutable]  pages/products/index
err: b3a251f0bfe837f702a7.js   1.17 KiB       3  [emitted] [immutable]  pages/articles/_slug/index
err: b68201808fd6f4aec517.js   10.1 KiB       4  [emitted] [immutable]  pages/articles/categories/_slug
err: d7cc3a28494e6a6dcc7a.js   15.3 KiB       9  [emitted] [immutable]  pages/docs/index
err: e0d85ab9fd3f1ed51e0d.js   1.35 KiB       1  [emitted] [immutable]  pages/_
err:               server.js    205 KiB       0  [emitted]              app
err:    server.manifest.json  957 bytes          [emitted]              
err: Entrypoint app = server.js
err: 3000/tcp:           
out:  31207
out: > webhostgb@1.0.0 start /root/whgb-new
out: > nuxt start
out: 
out:  Listening on: http://localhost:3000/
2020/05/31 01:39:05 Error: command timeout
err: Run Command Timeout!
1个回答

16

我也遇到了同样的错误,但是通过设置变量command_timeout,我解决了这个问题。

例如:

...
port: 22
command_timeout: 200m
...

也许可以帮助你。

你好,@Alexis,请问这是什么意思?command_timeout: 200m。如果我设置 command_timeout: 20sec 会发生什么?谢谢。 - MD Nasirul Islam
200m 表示 200 分钟,这是文档链接: https://github.com/appleboy/ssh-action 如果你想要 20 秒,可以试试这样写: 20s - Alexis Le Baron

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接