generated from actions/typescript-action
-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yml
61 lines (57 loc) · 2.06 KB
/
action.yml
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
56
57
58
59
60
61
name: 'Coiled Login'
description: 'GitHub Action to login to Coiled'
author: 'Coiled'
branding:
icon: 'log-in'
color: 'blue'
inputs:
token:
description: "Coiled user API token. Required. You can create a token at https://cloud.coiled.io/profile?createTokenDialog=1"
required: true
workspace:
description: "Coiled workspace. If not set, will default to user's default workspace."
required: false
server:
description: "Coiled server URL. If not set, will default to https://cloud.coiled.io ."
required: false
runs:
using: 'composite'
steps:
- name: Check if token is set
shell: bash
run: |
if [[ -z "${{ inputs.token }}" ]]; then
echo "Token is required."
exit 1
fi
- uses: actions/checkout@v4
- name: Install conda environment
uses: mamba-org/setup-micromamba@v1
env:
PYTHON_VERSION: 3.12
COILED_VERSION: 1.45.0
with:
cache-downloads-key: coiled-login-downloads-${{ runner.arch }}-${{ env.PYTHON_VERSION }}-${{ env.COILED_VERSION }}
cache-environment-key: coiled-login-env-${{ runner.arch }}-${{ env.PYTHON_VERSION }}-${{ env.COILED_VERSION }}
generate-run-shell: false
environment-name: coiled-login
create-args: >-
python=${{ env.PYTHON_VERSION }}
coiled=${{ env.COILED_VERSION }}
- name: Run coiled login
shell: bash
env:
INPUT_SERVER: ${{ inputs.server }}
INPUT_WORKSPACE: ${{ inputs.workspace }}
INPUT_TOKEN: ${{ inputs.token }}
run: |
args=()
for input in token server workspace; do
var_name="INPUT_${input^^}" # Convert input to uppercase
var_name=$(echo "$var_name" | tr '-' '_') # Replace '-' with '_'
value="${!var_name}" # Use variable indirection to get the value
if [[ -n "$value" ]]; then
args+=("--$input" "$value")
fi
done
micromamba run -n coiled-login coiled login "${args[@]}"