Skip to content

Commit

Permalink
Add a script to clone all patterns
Browse files Browse the repository at this point in the history
  • Loading branch information
mbaldessari committed Sep 5, 2024
1 parent 4a4f88e commit 8aa556d
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions scripts/clone-all-patterns.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash
set -e -o pipefail

# Lists all repos tagged with "pattern" in the two organizations:
# - validatedpatterns
# - validatedpatterns-sandbox

ORGS=("validatedpatterns" "validatedpatterns-sandbox")
TOPIC=${TOPIC:-pattern}
BASE=${BASE:-/tmp/pattern}

mkdir -p "${BASE}" || /bin/true

for org in ${ORGS[@]}; do
REPOS=$(gh repo list "${org}" --no-archived --topic "${TOPIC}" --visibility public --limit 100 |awk '{ print $1 }' | sort)
ret=$?
if [ ${ret} -ne 0 ]; then
echo "Error retrieving pattern list for ${org}"
exit ${ret}
fi
while IFS= read -r repo; do
echo "Cloning: ${repo} into ${BASE}/${repo}"
mkdir -p "${BASE}/${org}" || /bin/true
pushd "${BASE}/${org}"
git clone [email protected]:${repo}
pushd "${BASE}/${repo}"
git checkout -b "scripted-changes"
popd
popd
done <<< "$REPOS"
done

0 comments on commit 8aa556d

Please sign in to comment.