GithubHelp home page GithubHelp logo

owenthereal / action-upterm Goto Github PK

View Code? Open in Web Editor NEW

This project forked from lhotari/action-upterm

0.0 1.0 0.0 417 KB

Debug your GitHub Actions via SSH by using upterm/tmux to get access to the runner system itself.

License: MIT License

JavaScript 99.99% Shell 0.01%

action-upterm's Introduction

Debug your GitHub Actions by using ssh

This GitHub Action offers you a direct way to interact with the host system on which the actual scripts (Actions) will run. This action started as a fork of mxschmitt/action-tmate. Instead of tmate, this action uses upterm and tmux.

Features

  • Debug your GitHub Actions by using SSH
  • Continue your Workflows afterwards

Supported Operating Systems

  • Linux
  • macOS
  • (Windows is not supported. It will be skipped so that the Pipeline does not fail)

Getting Started

By using this minimal example a upterm session will be created.

name: CI
on: [push]
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
    - name: Setup upterm session
      uses: owenthereal/action-upterm@main

To get the ssh connection string, just open the Checks tab in your Pull Request and scroll to the bottom.

Use registered public SSH key(s)

By default anybody can connect to the upterm session. You can opt-in to install the public SSH keys that you have registered with your GitHub profile.

name: CI
on: [push]
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
    - name: Setup upterm session
      uses: owenthereal/action-upterm@main
      with:
        ## limits ssh access and adds the ssh public key for the user which triggered the workflow
        limit-access-to-actor: true
        ## limits ssh access and adds the ssh public keys of the listed GitHub users
        limit-access-to-users: githubuser1,githubuser2

If the registered public SSH key is not your default private SSH key, you will need to specify the path manually, like so: ssh -i <path-to-key> <upterm-connection-string>.

Use custom upterm server

Follow instructions to deploy Upterm server to Heroku. There are also other deployment options available.

You can configure the Upterm server with the upterm-server input parameter, for example:

name: CI
on: [push]
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
    - name: Setup upterm session
      uses: owenthereal/action-upterm@main
      with:
        ## limits ssh access and adds the ssh public key for the user which triggered the workflow
        limit-access-to-actor: true
        ## Use the Heroku deployed Uptermd server via Websocket
        upterm-server: wss://YOUR_HEROKU_APP_URL

Shut down server if user doesn't connect

If you'd like to shut down the server after a certain number of minutes if no user connects, use the wait-timeout-minutes input parameter. This can be useful for using action-upterm to get a debug shell if your job fails, but not have the debug shell keep your pipeline running for too long if no one is interested in debugging it.

name: CI
on: [push]
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
    - name: Setup upterm session
      uses: owenthereal/action-upterm@main
      if: ${{ failure() }}
      with:
        ## If no one connects after 5 minutes, shut down server.
        wait-timeout-minutes: 5

Continue a workflow

If you want to continue a workflow and you are inside a upterm session, just create a empty file with the name continue either in the root directory or in the workspace directory by running touch continue or sudo touch /continue. Closing the terminal will also continue the workflow. However you won't be able to reconnect in that case. It's possible to detach from the terminal and not continue by first pressing C-b and then d (tmux detach command keys).

Usage tips

Resizing tmux window (requires ubuntu-latest)

After connecting with ssh:

  • Hit control-b, then type :resize-window -A + <enter>

This will resize the console to the full width and height of the connected terminal. (More information)

action-upterm's People

Contributors

gableroux avatar lhotari avatar owenthereal avatar telotortium avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.