Skip to content

Commit 9aac550

Browse files
committed
feat(brew-bump): add check for cleanup step
1 parent f2be106 commit 9aac550

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

ci/steps/brew-bump.sh

+15-8
Original file line numberDiff line numberDiff line change
@@ -61,28 +61,31 @@ main() {
6161

6262
# GIT_ASKPASS lets us use the password when pushing without revealing it in the process list
6363
# See: https://serverfault.com/a/912788
64-
GIT_ASKPASS="$HOME/git-askpass.sh"
64+
PATH_TO_GIT_ASKPASS="$HOME/git-askpass.sh"
6565
# Source: https://serverfault.com/a/912788
6666
# shellcheck disable=SC2016,SC2028
67-
echo '#!/bin/sh\nexec echo "$HOMEBREW_GITHUB_API_TOKEN"' > "$GIT_ASKPASS"
67+
echo 'echo $HOMEBREW_GITHUB_API_TOKEN' > "$PATH_TO_ASKPASS"
6868

6969
# Make sure the git-askpass.sh file creation is successful
70-
if [[ $(file_exists "git-askpass.sh") -eq 1 ]]; then
70+
if [[ $(file_exists "$PATH_TO_GIT_ASKPASS") -eq 1 ]]; then
7171
echo "git-askpass.sh not found in $HOME."
7272
ls -la "$HOME"
7373
exit 1
7474
fi
7575

7676
# Ensure it's executable since we just created it
77-
chmod +x "$GIT_ASKPASS"
77+
chmod +x "$PATH_TO_GIT_ASKPASS"
7878

7979
# Make sure the git-askpass.sh file is executable
80-
if [[ $(is_executable "$GIT_ASKPASS") -eq 1 ]]; then
81-
echo "git-askpass.sh is not executable."
82-
ls -la "$GIT_ASKPASS"
80+
if [[ $(is_executable "$PATH_TO_GIT_ASKPASS") -eq 1 ]]; then
81+
echo "$PATH_TO_GIT_ASKPASS is not executable."
82+
ls -la "$PATH_TO_GIT_ASKPASS"
8383
exit 1
8484
fi
8585

86+
# Export the variables so git sees them
87+
export HOMEBREW_GITHUB_API_TOKEN="$HOMEBREW_GITHUB_API_TOKEN"
88+
export GIT_ASKPASS="$PATH_TO_ASKPASS"
8689
git push https://[email protected]/cdr-oss/homebrew-core.git --all
8790

8891
# Find the docs for bump-formula-pr here
@@ -101,7 +104,11 @@ main() {
101104
cd ..
102105
rm -rf homebrew-core
103106

104-
# TODO@jsjoeio - check that homebrew-core was removed
107+
# Make sure homebrew-core is removed
108+
if [[ $(directory_exists "homebrew-core") -eq 0 ]]; then
109+
echo "rm -rf homebrew-core failed."
110+
ls -la
111+
fi
105112
}
106113

107114
main "$@"

0 commit comments

Comments
 (0)