Skip to content

Instantly share code, notes, and snippets.

@KyMidd

KyMidd/asdf.sh Secret

Created February 19, 2023 17:14
Show Gist options
  • Select an option

  • Save KyMidd/9d82e10605e1cbd014b65cdf9ab78f06 to your computer and use it in GitHub Desktop.

Select an option

Save KyMidd/9d82e10605e1cbd014b65cdf9ab78f06 to your computer and use it in GitHub Desktop.
# Grab all repo clone values
getRepoCloneValues=$(cat project_repos_raw | jq --raw-output --arg repo "$repo" '
.values[]
| select( .name | contains($repo)).links.clone[]
| select( .name | contains("ssh")) | .href')
# Select first repo clone value if there are multiple
IFS=';' read -r stashRepoUrl string <<< "$getRepoCloneValues"
# Clone old repo
git clone --mirror $stashRepoUrl $repo
# Change context into folder
cd $repo
# Attempt push trap results
echo "Attempting git push --mirror without any modifications"
gitPushResults=
gitPushResults=$(git push --mirror https://oauth2:$GITHUB_TOKEN@github.com/$github_project_name/$github_repo_name.git --porcelain 2>&1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment