Skip to content

Commit 498c58d

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

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

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

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,33 @@ 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 8)"
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+
echo 'url-mappings:' > $MAPPINGS_YML
166+
167+
yq -r '.["repository-mappings"] | to_entries[] |
168+
"SUBDIR=$(openssl rand -hex 8)
169+
git clone \\"\(.value)\\" \\"'"$RANDOM_DIR"'/$SUBDIR\\"
170+
echo \\" '"'"'\\(.key)'"'"': '"'$RANDOM_DIR"'/$SUBDIR'"'"'\\" >> '"$MAPPINGS_YML"'"' < "$INPUT_YML" | bash
171+
172+
echo "Repositories cloned and mapped in $RANDOM_DIR — output saved to $MAPPINGS_YML"
173+
147174
- name: Before postprocess
148175
if: ${{inputs.before_postprocess}}
149176
run: ${{inputs.before_postprocess}}

0 commit comments

Comments
 (0)