-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(brew-bump): add check for cleanup step
- Loading branch information
Showing
1 changed file
with
15 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -61,28 +61,31 @@ main() { | |
|
||
# GIT_ASKPASS lets us use the password when pushing without revealing it in the process list | ||
# See: https://serverfault.com/a/912788 | ||
GIT_ASKPASS="$HOME/git-askpass.sh" | ||
PATH_TO_GIT_ASKPASS="$HOME/git-askpass.sh" | ||
# Source: https://serverfault.com/a/912788 | ||
# shellcheck disable=SC2016,SC2028 | ||
echo '#!/bin/sh\nexec echo "$HOMEBREW_GITHUB_API_TOKEN"' > "$GIT_ASKPASS" | ||
echo 'echo $HOMEBREW_GITHUB_API_TOKEN' > "$PATH_TO_ASKPASS" | ||
|
||
# Make sure the git-askpass.sh file creation is successful | ||
if [[ $(file_exists "git-askpass.sh") -eq 1 ]]; then | ||
if [[ $(file_exists "$PATH_TO_GIT_ASKPASS") -eq 1 ]]; then | ||
echo "git-askpass.sh not found in $HOME." | ||
ls -la "$HOME" | ||
exit 1 | ||
fi | ||
|
||
# Ensure it's executable since we just created it | ||
chmod +x "$GIT_ASKPASS" | ||
chmod +x "$PATH_TO_GIT_ASKPASS" | ||
|
||
# Make sure the git-askpass.sh file is executable | ||
if [[ $(is_executable "$GIT_ASKPASS") -eq 1 ]]; then | ||
echo "git-askpass.sh is not executable." | ||
ls -la "$GIT_ASKPASS" | ||
if [[ $(is_executable "$PATH_TO_GIT_ASKPASS") -eq 1 ]]; then | ||
echo "$PATH_TO_GIT_ASKPASS is not executable." | ||
ls -la "$PATH_TO_GIT_ASKPASS" | ||
exit 1 | ||
fi | ||
|
||
# Export the variables so git sees them | ||
export HOMEBREW_GITHUB_API_TOKEN="$HOMEBREW_GITHUB_API_TOKEN" | ||
export GIT_ASKPASS="$PATH_TO_ASKPASS" | ||
git push https://[email protected]/cdr-oss/homebrew-core.git --all | ||
|
||
# Find the docs for bump-formula-pr here | ||
|
@@ -101,7 +104,11 @@ main() { | |
cd .. | ||
rm -rf homebrew-core | ||
|
||
# TODO@jsjoeio - check that homebrew-core was removed | ||
# Make sure homebrew-core is removed | ||
if [[ $(directory_exists "homebrew-core") -eq 0 ]]; then | ||
echo "rm -rf homebrew-core failed." | ||
ls -la | ||
fi | ||
} | ||
|
||
main "$@" |