Skip to content

Commit 678cffe

Browse files
refactor: pre-compute CLI flags as env vars, no bash conditionals
Per review feedback: use GitHub Actions expressions to compute FORCE_FLAG and CONNECTOR_NAME_FLAG as env vars, then reference them directly in a clean one-liner CLI invocation. Co-Authored-By: AJ Steers <aj@airbyte.io>
1 parent 248e831 commit 678cffe

File tree

1 file changed

+10
-19
lines changed

1 file changed

+10
-19
lines changed

.github/workflows/generate-connector-registries.yml

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ on:
1313
type: boolean
1414
default: false
1515
connector-name:
16-
description: "Comma-separated list of connector names to limit the latest/ resync scope (e.g. 'source-faker,source-github'). Leave empty to compile all connectors."
16+
description: "A connector name to limit the latest/ resync scope (e.g. 'source-faker'). Leave empty to compile all connectors."
1717
required: false
1818
type: string
1919
workflow_call:
@@ -52,22 +52,13 @@ jobs:
5252
- name: Compile Registries
5353
env:
5454
GCS_CREDENTIALS: ${{ secrets.METADATA_SERVICE_PROD_GCS_CREDENTIALS }}
55-
INPUT_FORCE: ${{ inputs.force }}
56-
INPUT_CONNECTOR_NAME: ${{ inputs.connector-name }}
55+
FORCE_FLAG: ${{ inputs.force == true && '--force' || '' }}
56+
CONNECTOR_NAME_FLAG: ${{ inputs.connector-name && format('--connector-name {0}', inputs.connector-name) || '' }}
5757
shell: bash
58-
run: |
59-
COMPILE_ARGS="airbyte-ops registry store compile"
60-
COMPILE_ARGS="${COMPILE_ARGS} --store ${REGISTRY_STORE}"
61-
COMPILE_ARGS="${COMPILE_ARGS} --with-secrets-mask"
62-
COMPILE_ARGS="${COMPILE_ARGS} --with-legacy-migration v1"
63-
if [[ "${INPUT_FORCE}" == "true" ]]; then
64-
COMPILE_ARGS="${COMPILE_ARGS} --force"
65-
fi
66-
if [[ -n "${INPUT_CONNECTOR_NAME}" ]]; then
67-
IFS=',' read -ra CONNECTORS <<< "${INPUT_CONNECTOR_NAME}"
68-
for c in "${CONNECTORS[@]}"; do
69-
COMPILE_ARGS="${COMPILE_ARGS} --connector-name $(echo "$c" | xargs)"
70-
done
71-
fi
72-
echo "Running: ${COMPILE_ARGS}"
73-
${COMPILE_ARGS}
58+
run: >
59+
airbyte-ops registry store compile
60+
--store "${REGISTRY_STORE}"
61+
--with-secrets-mask
62+
--with-legacy-migration v1
63+
${FORCE_FLAG}
64+
${CONNECTOR_NAME_FLAG}

0 commit comments

Comments
 (0)