mirror of
				https://github.com/shivammathur/setup-php.git
				synced 2025-10-31 07:16:22 +07:00 
			
		
		
		
	Use ls-remote to get default branch
Calling GitHub API on macOS without the token hits rate limit
This commit is contained in:
		| @ -4,7 +4,7 @@ fetch_brew_tap() { | ||||
|   tap_user=$(dirname "$tap") | ||||
|   tap_name=$(basename "$tap") | ||||
|   mkdir -p "$tap_dir/$tap_user" | ||||
|   branch="$(get -s -n "" "https://api.github.com/repos/$tap" | grep default_branch | cut -d: -f 2 | grep -Eo '[^\", ]+' | tr -d '\n')" | ||||
|   branch="$(git ls-remote --symref "https://github.com/$tap" HEAD | grep -Eo 'refs/heads/.*' | tr '\t' '\n' | head -1 | cut -d '/' -f 3)" | ||||
|   get -s -n "" "https://github.com/$tap/archive/$branch.tar.gz" | sudo tar -xzf - -C "$tap_dir/$tap_user" | ||||
|   sudo mv "$tap_dir/$tap_user/$tap_name-$branch" "$tap_dir/$tap_user/$tap_name" | ||||
| } | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 Shivam Mathur
					Shivam Mathur