-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaction.yml
More file actions
35 lines (32 loc) · 1001 Bytes
/
action.yml
File metadata and controls
35 lines (32 loc) · 1001 Bytes
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
name: Parse Server Credentials
description: A GitHub Action to parse a server string into its components
inputs:
SERVER:
description: The server string to parse
required: true
outputs:
USERNAME:
description: The username component of the server string
value: ${{steps.script.outputs.USERNAME}}
HOST:
description: The host component of the server string
value: ${{steps.script.outputs.HOST}}
PORT:
description: The port component of the server string
value: ${{steps.script.outputs.PORT}}
runs:
using: composite
steps:
- id: script
name: Run Script
shell: bash
run: |
SERVER="${{inputs.SERVER}}"
if [[ $SERVER =~ ^([^@]+)@([^:]+):([0-9]+)$ ]]; then
echo USERNAME="${BASH_REMATCH[1]}" >> $GITHUB_OUTPUT
echo HOST="${BASH_REMATCH[2]}" >> $GITHUB_OUTPUT
echo PORT="${BASH_REMATCH[3]}" >> $GITHUB_OUTPUT
else
echo "Error: Invalid SERVER format"
exit 1
fi