Skip to content
This repository was archived by the owner on Dec 29, 2025. It is now read-only.

Commit dccb4f9

Browse files
committed
feat(integration): add example how to decode buildingBlockRun inputs in GitHub action job step using jq
1 parent 24fdff6 commit dccb4f9

File tree

1 file changed

+30
-1
lines changed

1 file changed

+30
-1
lines changed

docs/integrations/github/github-actions.md

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,36 @@ on:
145145
required: true
146146
```
147147
148-
This setup allows application teams to quickly and efficiently access automation workflows from the marketplace, enhancing their productivity and reducing the need for Git expertise.
148+
Within a job, you need to decode the `buildingBlockRun` input.
149+
Define a job step to decode all Building Block inputs as follows and provide them to following steps:
150+
```yaml
151+
jobs:
152+
some-job:
153+
runs-on: ubuntu-latest # ships with jq already!
154+
steps:
155+
# ... some other steps
156+
- name: Decode buildingBlockRun inputs
157+
id: decodeBuildingBlockInputs
158+
shell: bash
159+
env:
160+
# pass in indirectly as env variable to avoid cluttering the job log with a large base64 string
161+
BUILDING_BLOCK_RUN_INPUT: ${{ inputs.buildingBlockRun }}
162+
run: |
163+
set -euo pipefail
164+
base64 -d <<<"$BUILDING_BLOCK_RUN_INPUT" \
165+
| jq -er '
166+
.spec.buildingBlock.spec.inputs
167+
| unique_by(.key)
168+
| .[]
169+
| "\(.key)=\(.value)"
170+
' \
171+
| tee -a "$GITHUB_OUTPUT" # assumes no secrets are passed in as inputs, as they're printed by tee!
172+
# ... do something with the output (example):
173+
- name: Some step using an input
174+
run: |
175+
# Assumes the building block definition has an input called 'github_handle'
176+
echo '${{ steps.decodeBuildingBlockInputs.outputs.github_handle }}'
177+
```
149178

150179
### Status Updates
151180

0 commit comments

Comments
 (0)