Skip to content

Commit c127017

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

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

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

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,36 @@ 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+
export 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 | to_entries[] |
168+
"\(strenv(RANDOM_DIR))/\(.key)" as $SUBDIR |
169+
"
170+
git clone \"\(.value.value | sub(\"github.com\"; \"x-access-token:${{secrets.GITHUB_TOKEN}}@github.com\"))\" \"\($SUBDIR)\"
171+
echo \" \\\"\(.value.key)\\\": \\\"\($SUBDIR)\\\"\" >> bblocks-config-local.yml
172+
"
173+
' < $INPUT_YML | bash
174+
175+
echo "Repositories cloned and mapped in $RANDOM_DIR — output saved to $MAPPINGS_YML"
176+
147177
- name: Before postprocess
148178
if: ${{inputs.before_postprocess}}
149179
run: ${{inputs.before_postprocess}}

0 commit comments

Comments
 (0)