|
| 1 | +# .github/workflows/interactive_shell.yml |
| 2 | +name: Interactive Runner Shell via tmate |
| 3 | + |
| 4 | +on: |
| 5 | + workflow_dispatch: # 允许手动触发 |
| 6 | + |
| 7 | +jobs: |
| 8 | + debug_runner_shell: |
| 9 | + runs-on: ubuntu-latest # 您可以根据需要更改为 windows-latest 或 macos-latest |
| 10 | + timeout-minutes: 60 # 设置作业的整体超时时间,tmate 会话将在此时间内有效 |
| 11 | + |
| 12 | + steps: |
| 13 | + - name: Checkout repository |
| 14 | + uses: actions/checkout@v4 |
| 15 | + |
| 16 | + # (可选步骤) 预安装一些您可能想在 shell 中立即使用的工具 |
| 17 | + - name: Install common tools (e.g., tree, htop, ncdu) |
| 18 | + if: runner.os == 'Linux' # 仅在 Linux runner 上执行 |
| 19 | + run: | |
| 20 | + sudo apt-get update |
| 21 | + sudo apt-get install -y tree htop ncdu vim mc |
| 22 | + echo "Common tools installed." |
| 23 | + # 对于 Windows, 您可以使用 Chocolatey: |
| 24 | + # - name: Install common tools (Windows) |
| 25 | + # if: runner.os == 'Windows' |
| 26 | + # run: choco install tree mc # 示例工具 |
| 27 | + # 对于 macOS, 您可以使用 Homebrew: |
| 28 | + # - name: Install common tools (macOS) |
| 29 | + # if: runner.os == 'macOS' |
| 30 | + # run: brew install tree mc # 示例工具 |
| 31 | + |
| 32 | + - name: Setup tmate session for interactive debugging |
| 33 | + uses: mxschmitt/action-tmate@v3 |
| 34 | + with: |
| 35 | + # limit-access-to-actor: true # (推荐) 仅允许触发此 workflow 的用户连接 |
| 36 | + # sudo: false # 如果您不需要在 tmate 会话中无密码 sudo,可以设置为 false |
| 37 | + # install-dependencies: true # 确保 tmate 的依赖已安装 |
| 38 | + # timeout-minutes: 15 # (可选) 设置 tmate 会话本身的超时时间(分钟) |
| 39 | + # 如果不设置,将依赖于 job 的 timeout-minutes |
0 commit comments