Skip to content

Commit

Permalink
feat: action skeleton
Browse files Browse the repository at this point in the history
  • Loading branch information
apogiatzis committed Nov 15, 2020
0 parents commit e593892
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.DS_Store
42 changes: 42 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Ngrok tunelling Github Action

This is a Github Action that can be used in your Github Workflow to tunnel incoming/outgoing TCP traffic in your workflow environment.

The original use case for this was to achieve temporary deployment for CTF challenges under development but it can be as well used in many more other cases.

## How to use this Action

This action accepts the following parameters

| Name| Description | Required | Default |
| ------------- |-------------|-----|-----|
| timeout | After this timeout the deployment will automatically shutdown the tunelling and therefore stop the action. (max is 6 hours) | No | 1h |
| port | The port in localhost to forward traffic from/to | Yes | - |
| ngrok_authtoken | Your ngrok authtoken| Yes | - |

Here is an example of using this action:

```
name: CI
on: push
jobs:
deploy:
name: Deploy challenge
runs-on: ubuntu-latest
needs: cancel
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Run container
run: docker-compose up -d
- uses: ./
with:
timeout: 1h
port: 4000
ngrok_authtoken: ${{ secrets.NGROK_AUTHTOKEN }}
```
25 changes: 25 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: 'Ngrok TCP Tunelling'
description: 'A github action for tunelling TCP traffic from within Workflow environemt'
inputs:
timeout:
description: 'Challenge deployment timeout'
required: true
default: '1h'
port:
description: 'The port to forward traffic to'
required: true
ngrok_authtoken:
description: 'Ngrok authorization token'
required: true

runs:
using: "composite"
steps:
- run: wget https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.zip
shell: bash
- run: unzip -qq ngrok-stable-linux-amd64.zip
shell: bash
- run: ./ngrok authtoken ${{ inputs.ngrok_authtoken }}
shell: bash
- run: timeout ${{ inputs.timeout }} ./ngrok tcp ${{ inputs.port }}
shell: bash

0 comments on commit e593892

Please sign in to comment.