Skip to content

Commit 6d4f015

Browse files
fix: apply tee -a convention, env var injection guard, and simplify matrix step
- Use tee -a for all output vars (skill guideline #4) - Pass workflow_dispatch input via env: to prevent script injection (skill guideline #5) - Simplify generate_matrix to a one-liner receiving prior steps inline - Remove bash if/elif/else branching (skill guideline #2) Co-Authored-By: AJ Steers <aj@airbyte.io>
1 parent 85e8f59 commit 6d4f015

File tree

1 file changed

+12
-24
lines changed

1 file changed

+12
-24
lines changed

.github/workflows/connectors_up_to_date.yml

Lines changed: 12 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -32,59 +32,47 @@ jobs:
3232
# Call 1: Sources - all support levels, Python/low-code/manifest-only languages
3333
- name: List source connectors
3434
id: list-sources
35+
env:
36+
CONNECTOR_OPTIONS: ${{ github.event.inputs.connectors-options }}
3537
run: |
3638
SOURCES=$(
3739
airbyte-ops local connector list \
3840
--repo-path "$GITHUB_WORKSPACE" \
3941
--connector-type=source \
4042
--language python --language low-code --language manifest-only \
4143
--exclude-connectors=source-declarative-manifest \
42-
${{ github.event.inputs.connectors-options }} \
44+
$CONNECTOR_OPTIONS \
4345
--output-format=csv
4446
)
45-
echo "Sources: $SOURCES"
46-
echo "sources=$SOURCES" >> "$GITHUB_OUTPUT"
47+
echo "sources=$SOURCES" | tee -a $GITHUB_OUTPUT
4748
4849
# Call 2: Destinations - certified only, Python/low-code/manifest-only languages
4950
- name: List destination connectors
5051
id: list-destinations
52+
env:
53+
CONNECTOR_OPTIONS: ${{ github.event.inputs.connectors-options }}
5154
run: |
5255
DESTINATIONS=$(
5356
airbyte-ops local connector list \
5457
--repo-path "$GITHUB_WORKSPACE" \
5558
--connector-type=destination \
5659
--certified-only \
5760
--language python --language low-code --language manifest-only \
58-
${{ github.event.inputs.connectors-options }} \
61+
$CONNECTOR_OPTIONS \
5962
--output-format=csv
6063
)
61-
echo "Destinations: $DESTINATIONS"
62-
echo "destinations=$DESTINATIONS" >> "$GITHUB_OUTPUT"
64+
echo "destinations=$DESTINATIONS" | tee -a $GITHUB_OUTPUT
6365
6466
# Call 3: Combine both sets and output as GH Actions matrix
6567
- name: Generate matrix - 25 connectors per job
6668
id: generate_matrix
6769
run: |
68-
SOURCES="${{ steps.list-sources.outputs.sources }}"
69-
DESTINATIONS="${{ steps.list-destinations.outputs.destinations }}"
70-
71-
# Combine sources and destinations, then generate matrix via json-gh-matrix
72-
COMBINED=""
73-
if [ -n "$SOURCES" ] && [ -n "$DESTINATIONS" ]; then
74-
COMBINED="${SOURCES},${DESTINATIONS}"
75-
elif [ -n "$SOURCES" ]; then
76-
COMBINED="$SOURCES"
77-
else
78-
COMBINED="$DESTINATIONS"
79-
fi
80-
81-
MATRIX=$(
70+
echo "generated_matrix=$( \
8271
airbyte-ops local connector list \
8372
--repo-path "$GITHUB_WORKSPACE" \
84-
--connectors-filter="$COMBINED" \
85-
--output-format=json-gh-matrix
86-
)
87-
echo "generated_matrix=$MATRIX" >> "$GITHUB_OUTPUT"
73+
--connectors-filter="${{ steps.list-sources.outputs.sources }},${{ steps.list-destinations.outputs.destinations }}" \
74+
--output-format=json-gh-matrix \
75+
)" | tee -a $GITHUB_OUTPUT
8876
8977
run_connectors_up_to_date:
9078
needs: generate_matrix

0 commit comments

Comments
 (0)