commit fdb863be826c126b812414f3bbdc166b0eac85b4 Author: dm1sh Date: Sat Feb 26 22:56:20 2022 +0300 Initial release diff --git a/README.md b/README.md new file mode 100644 index 0000000..7f819a9 --- /dev/null +++ b/README.md @@ -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 }} +``` diff --git a/action.yml b/action.yml new file mode 100644 index 0000000..37d0c86 --- /dev/null +++ b/action.yml @@ -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 $! \ No newline at end of file