-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathaction.yaml
55 lines (52 loc) · 1.46 KB
/
action.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
name: SSH tunnel over ngrok
description: Establishes an ngrok tunnel to the GitHub Action runner for debugging
branding:
icon: minimize-2
color: purple
inputs:
timeout:
description: Tunnel timeout
required: true
default: 1h
port:
description: Local port to forward to
required: true
default: 22
ssh_public_key:
description: Your SSH public key
required: true
ngrok_token:
description: Your ngrok auth token
required: true
runs:
using: composite
steps:
- name: Download ngrok
run: curl -sO https://bin.equinox.io/c/bNyj1mQVY4c/ngrok-v3-stable-linux-amd64.tgz
shell: bash
- name: Untar ngrok
run: tar xfz ngrok-v3-stable-linux-amd64.tgz
shell: bash
- name: Add ~/.ssh directory
run: mkdir -p ~/.ssh
shell: bash
- name: Add SSH public key to authorized_keys
run: echo "${{ inputs.ssh_public_key }}" >> ~/.ssh/authorized_keys
shell: bash
- name: Fix home directory permissions
run: chmod 755 ~
shell: bash
- run: chmod 600 ~/.ssh/authorized_keys
shell: bash
- name: Set ngrok auth token
run: ./ngrok authtoken ${{ inputs.ngrok_token }}
shell: bash
- name: Debug message
run: echo "Starting ngrok tunnel..."
shell: bash
- name: Setup ngrok tunnel
run: timeout ${{ inputs.timeout }} ./ngrok tcp ${{ inputs.port }} &
shell: bash
- name: Debug message
run: echo "Tunnel started."
shell: bash