Skip to content

Commit a6edeb5

Browse files
committed
Test bblocks-repository-mappings
1 parent 8f4fc4b commit a6edeb5

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

.github/workflows/validate-and-process.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,32 @@ jobs:
144144
core.exportVariable('PAGES_BASE_URL', base_url);
145145
core.exportVariable('PAGES_PATH', parsed.pathname);
146146
return base_url;
147+
- name: Process local repository mappings
148+
run: |
149+
RANDOM_DIR="_repos_$(openssl rand -hex 4)"
150+
mkdir "$RANDOM_DIR"
151+
echo '*' > "${RANDOM_DIR}/.gitignore"
152+
153+
if [ -f "bblocks-repository-mappings.yaml" ]; then
154+
INPUT_YML="bblocks-repository-mappings.yaml"
155+
elif [ -f "bblocks-repository-mappings.yml" ]; then
156+
INPUT_YML="bblocks-repository-mappings.yml"
157+
fi
158+
159+
if [ -z "$INPUT_YML" ]; then
160+
echo "No local repository mappings found"
161+
exit 0
162+
fi
163+
164+
MAPPINGS_YML="bblocks-config-local.yml"
165+
166+
yq -r '.["repository-mappings"] | to_entries[] |
167+
"SUBDIR=\$(openssl rand -hex 4)
168+
git clone '\(.value)' '"$RANDOM_DIR"'/\$SUBDIR
169+
echo \" '\(.key)': '"$RANDOM_DIR"/\$SUBDIR\'" >> '"$MAPPINGS_YML"'"' < "$INPUT_YML" | bash
170+
171+
echo "Repositories cloned and mapped in $RANDOM_DIR — output saved to $MAPPINGS_YML"
172+
147173
- name: Before postprocess
148174
if: ${{inputs.before_postprocess}}
149175
run: ${{inputs.before_postprocess}}

0 commit comments

Comments
 (0)