-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaction.yaml
More file actions
189 lines (161 loc) · 5.64 KB
/
action.yaml
File metadata and controls
189 lines (161 loc) · 5.64 KB
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
name: 'Flow Execute'
description: 'Execute flow workflows in GitHub Actions'
author: 'jahvon'
inputs:
executable:
description: 'Flow executable to run (e.g., "VERB NAME", "build app", "test unit", "deploy staging")'
required: true
workspace:
description: 'Flow workspace to use (path or name)'
required: false
default: '.'
workspace-name:
description: 'Name for the workspace (auto-generated if not provided)'
required: false
default: ''
workspaces:
description: 'YAML/JSON map of workspaces (supports local paths and git repositories)'
required: false
default: ''
clone-token:
description: 'GitHub token for cloning private repositories'
required: false
default: ''
clone-depth:
description: 'Git clone depth for repository cloning (0 for full history)'
required: false
default: '1'
flow-version:
description: 'Version of flow CLI to install'
required: false
default: 'latest'
params:
description: 'Parameters to pass to the executable (KEY=VALUE pairs, one per line or comma-separated)'
required: false
default: ''
env:
description: 'Environment variables to set during execution (KEY=VALUE pairs, one per line)'
required: false
default: ''
secrets:
description: 'Secrets to set in flow vault (KEY=VALUE pairs, one per line; JSON object also accepted)'
required: false
default: ''
vault-key:
description: 'Vault encryption key (for existing vaults)'
required: false
working-directory:
description: 'Directory to run flow from'
required: false
default: '.'
timeout:
description: 'Timeout for executable execution'
required: false
default: '30m'
upload:
description: 'Upload flow logs as an artifact'
required: false
default: 'false'
continue-on-error:
description: 'Continue workflow if flow executable fails'
required: false
default: 'false'
outputs:
exit-code:
description: 'Exit code of the flow executable'
value: ${{ steps.flow-exec.outputs.exit-code }}
output:
description: 'Output from the flow executable'
value: ${{ steps.flow-exec.outputs.output }}
vault-key:
description: 'Generated vault encryption key (when secrets are configured without a provided key)'
value: ${{ steps.flow-vault.outputs.vault-key }}
error-code:
description: 'Machine-readable error code from flow (e.g., EXECUTION_FAILED, TIMEOUT, NOT_FOUND)'
value: ${{ steps.flow-exec.outputs.error-code }}
runs:
using: 'composite'
steps:
- name: Resolve flow install path
shell: bash
id: flow-paths
run: |
case "$(uname -s)" in
MINGW*|MSYS*|CYGWIN*) echo "install-dir=$(cygpath -w "$HOME/bin")" >> "$GITHUB_OUTPUT" ;;
*) echo "install-dir=/usr/local/bin" >> "$GITHUB_OUTPUT" ;;
esac
version="${FLOW_VERSION:-latest}"
if [ "$version" = "main" ]; then
echo "cache-key=flow-main-${{ runner.os }}-${{ runner.arch }}-$(date +%Y%m%d)" >> "$GITHUB_OUTPUT"
else
echo "cache-key=flow-${version}-${{ runner.os }}-${{ runner.arch }}" >> "$GITHUB_OUTPUT"
fi
env:
FLOW_VERSION: ${{ inputs.flow-version }}
- name: Cache flow binary
uses: actions/cache@v4
id: flow-cache
with:
path: ${{ steps.flow-paths.outputs.install-dir }}/flow*
key: ${{ steps.flow-paths.outputs.cache-key }}
- name: Install flow CLI
shell: bash
run: |
# Install flow CLI
source "$SCRIPTS_DIR/install-flow.sh"
env:
SCRIPTS_DIR: ${{ github.action_path }}/scripts
FLOW_VERSION: ${{ inputs.flow-version }}
TIMEOUT: ${{ inputs.timeout }}
CACHE_HIT: ${{ steps.flow-cache.outputs.cache-hit }}
- name: Setup flow workspaces
shell: bash
run: |
# Setup flow workspaces
source "$SCRIPTS_DIR/setup-workspaces.sh"
working-directory: ${{ inputs.working-directory }}
env:
SCRIPTS_DIR: ${{ github.action_path }}/scripts
WORKSPACES_INPUT: ${{ inputs.workspaces }}
WORKSPACE_PATH: ${{ inputs.workspace }}
WORKSPACE_NAME: ${{ inputs.workspace-name }}
CLONE_TOKEN: ${{ inputs.clone-token }}
CLONE_DEPTH: ${{ inputs.clone-depth }}
EXECUTABLE_INPUT: ${{ inputs.executable }}
- name: Setup vault and secrets
shell: bash
run: |
# Setup vault and secrets
source "$SCRIPTS_DIR/setup-vault.sh"
working-directory: ${{ inputs.working-directory }}
id: flow-vault
if: inputs.secrets != '' || inputs.vault-key != ''
env:
SCRIPTS_DIR: ${{ github.action_path }}/scripts
SECRETS_INPUT: ${{ inputs.secrets }}
VAULT_KEY: ${{ inputs.vault-key }}
- name: Execute flow executable
shell: bash
run: |
# Execute: flow ${{ inputs.executable }}
source "$SCRIPTS_DIR/execute.sh"
working-directory: ${{ inputs.working-directory }}
id: flow-exec
env:
SCRIPTS_DIR: ${{ github.action_path }}/scripts
EXECUTABLE_INPUT: ${{ inputs.executable }}
PARAMS_INPUT: ${{ inputs.params }}
ENV_INPUT: ${{ inputs.env }}
VAULT_KEY: ${{ inputs.vault-key }}
CONTINUE_ON_ERROR: ${{ inputs.continue-on-error }}
CAPTURE: ${{ inputs.upload == 'true' }}
- name: Upload flow logs
uses: actions/upload-artifact@v4
if: ${{ inputs.upload == 'true' && steps.flow-exec.outputs.exit-code != '0' }}
with:
name: flow-executable-logs-${{ github.job }}
path: ${{ inputs.working-directory }}/executable_output.txt
retention-days: 1
branding:
icon: 'play'
color: 'white'