在线调试github action中的项目

2024-08-22 09:06:20 浏览数 (1)

yaml文件内容:

代码语言:bash复制
    name: Remote-SSH
    on:
      watch:
        types: started
    jobs:
      SSH:
        name: Run on ${{ matrix.os }}
        runs-on: ${{ matrix.os }}
        strategy:
          max-parallel: 4
          matrix:
            python-version: [3.8]
            os: [ubuntu-latest]
        steps:
          - name: Set up Python ${{ matrix.python-version }}
            uses: actions/setup-python@v1
            with:
              python-version: ${{ matrix.python-version }}
          - name: Install dependencies
            run: |
              python -m pip install --upgrade pip
              python -m pip install -U tmate
          - name: SSH connection to Actions
            run: |
                python -m tmate

按照上面配置好后,只需要star项目后就会自动运行该项目。如果修改了内容,再取消start再start即可。

示例:https://github.com/Yezhoubing/debug_github_action/

结果:

一般在浏览器输入[Notify] web session中的网址即可

或者在自己的cmd终端中输入[Notify] ssh session中的内容:如ssh vxejwADnLBwNXQS9F3d6jkEes@sgp1.tmate.io(todo:目前报错SSH客户端和服务器在压缩方法上无法达成一致)

参考博客

0 人点赞