Initial release

This commit is contained in:
Dmitriy Shishkov 2022-02-26 22:56:20 +03:00
commit fdb863be82
No known key found for this signature in database
GPG Key ID: 14358F96FCDD8060
2 changed files with 72 additions and 0 deletions

43
README.md Normal file
View File

@ -0,0 +1,43 @@
# Mac OS 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 running on Mac OS.
## How to use
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 |
| protocol | Protocol that will be used by Ngrok: tcp or http | No | tcp |
| port | The port in localhost to forward traffic from/to | Yes | - |
| ngrok_authtoken | Your ngrok authtoken | Yes | - |
You also need to set up `NGROK_AUTHTOKEN` secret with token required from [here](https://dashboard.ngrok.com/get-started/your-authtoken)
Example usage:
```yaml
name: CI
on: push
jobs:
deploy:
name: Deploy challenge
runs-on: macos-latest
needs: cancel
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Run container
run: docker-compose up -d
- uses: dm1sh/macos-ngrok-action
with:
timeout: 1h
port: 8080
ngrok_authtoken: ${{ secrets.NGROK_AUTHTOKEN }}
```

29
action.yml Normal file
View File

@ -0,0 +1,29 @@
name: 'Mac OS Ngrok tunelling'
description: 'A github action for tunelling TCP traffic from within Workflow environemt'
branding:
icon: 'activity'
color: 'blue'
inputs:
timeout:
description: 'Tunelling time'
required: true
default: '1h'
port:
description: 'The port to forward traffic to'
required: true
protocol:
description: 'Protocol that will be used for tunelling: tcp or http'
required: true
default: 'tcp'
ngrok_authtoken:
description: 'Ngrok authorization token'
required: true
runs:
using: "composite"
steps:
- run: brew install -cask ngrok
- run: ngrok authtoken ${{ inputs.ngrok_authtoken }}
- run: (ngrok ${{ inputs.protocol }} ${{ inputs.port }}) & sleep ${{ inputs.timeout }} ; kill $!