Skip to content

Commit

Permalink
Merge branch 'main' into tests-on-github-actions
Browse files Browse the repository at this point in the history
  • Loading branch information
fmasuhr authored Apr 23, 2024
2 parents 92e1e14 + 443a773 commit aec863c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
1 change: 1 addition & 0 deletions Brewfile
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ cask '1password7'
cask 'threema-beta'

mas 'Amphetamine', id: 937_984_704
mas 'Boop', id: 1_518_425_043
mas 'Reeder', id: 1_529_448_980
mas 'Wipr', id: 1_320_666_476
mas 'Xcode', id: 497_799_835
16 changes: 11 additions & 5 deletions bin/projects
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
GITHUB_USERNAME=${GITHUB_USERNAME:-$(gh api user | jq -r '.login')}

PROJECTS_PATH=${PROJECTS_PATH:-~/github}
STARED_REPOSITORIES=$(gh api users/${GITHUB_USERNAME}/starred --paginate | jq -r '.[] | .full_name')
STARED_REPOSITORIES=$(gh api users/${GITHUB_USERNAME}/starred --paginate | jq -c '.[] | {full_name: .full_name, archived: .archived}')

# Get emails of authenticated github user
EMAILS=($(gh api user/emails --paginate | jq -r '.[] | .email'))
Expand All @@ -16,14 +16,20 @@ reset=`tput sgr0`

for repository in $STARED_REPOSITORIES;
do
repository_path="${PROJECTS_PATH}/${repository}"
full_name=$(echo $repository | jq -r '.full_name')
archived=$(echo $repository | jq -r '.archived')
repository_path="${PROJECTS_PATH}/${full_name}"

if [ $archived == 'true' ]; then
echo "$full_name is archived but still starred"
fi

if [ ! -d $repository_path ]; then
# Clone repository as it does not exist locally yet

# if no 'git config user.email' configure one of the github emails
if [ $(git -C $PROJECTS_PATH config user.email) == '(none)' ]; then
echo "Select the git config user.email for '${repository}'"
echo "Select the git config user.email for '${full_name}'"

# List available emails
for i in "${!EMAILS[@]}"; do
Expand All @@ -37,9 +43,9 @@ do
! [[ $email_index -ge 1 && $email_index -le ${#EMAILS[@]} ]] && unset email_index
done

gh repo clone "[email protected]:${repository}.git" $repository_path && git -C $repository_path config user.email "${EMAILS[$((email_index - 1))]}" &
gh repo clone "[email protected]:${full_name}.git" $repository_path && git -C $repository_path config user.email "${EMAILS[$((email_index - 1))]}" &
else
gh repo clone "[email protected]:${repository}.git" $repository_path &
gh repo clone "[email protected]:${full_name}.git" $repository_path &
fi
else
# Pull latest changes into current branch
Expand Down

0 comments on commit aec863c

Please sign in to comment.