@@ -10,13 +10,13 @@ main() {
10
10
echo " Checking environment variables"
11
11
12
12
# We need VERSION to bump the brew formula
13
- if [[ $( is_env_var_set " VERSION" ) -eq 1 ]] ; then
13
+ if is_env_var_set " VERSION" ; then
14
14
echo " VERSION is not set"
15
15
exit 1
16
16
fi
17
17
18
18
# We need HOMEBREW_GITHUB_API_TOKEN to push up commits
19
- if [[ $( is_env_var_set " HOMEBREW_GITHUB_API_TOKEN" ) -eq 1 ]] ; then
19
+ if is_env_var_set " HOMEBREW_GITHUB_API_TOKEN" ; then
20
20
echo " HOMEBREW_GITHUB_API_TOKEN is not set"
21
21
exit 1
22
22
fi
@@ -29,14 +29,14 @@ main() {
29
29
git clone https://github.com/cdrci/homebrew-core.git
30
30
31
31
# Make sure the git clone step is successful
32
- if [[ $( directory_exists " homebrew-core" ) -eq 1 ]] ; then
32
+ if directory_exists " homebrew-core" ; then
33
33
echo " git clone failed. Cannot find homebrew-core directory."
34
34
ls -la
35
35
exit 1
36
36
fi
37
37
38
38
echo " Changing into homebrew-core directory"
39
- cd homebrew-core && pwd
39
+ pushd homebrew-core && pwd
40
40
41
41
echo " Adding Homebrew/homebrew-core"
42
42
git remote add upstream https://github.com/Homebrew/homebrew-core.git
@@ -61,28 +61,31 @@ main() {
61
61
62
62
# GIT_ASKPASS lets us use the password when pushing without revealing it in the process list
63
63
# See: https://serverfault.com/a/912788
64
- GIT_ASKPASS =" $HOME /git-askpass.sh"
64
+ PATH_TO_GIT_ASKPASS =" $HOME /git-askpass.sh"
65
65
# Source: https://serverfault.com/a/912788
66
66
# 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 "
68
68
69
69
# 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 " ; then
71
71
echo " git-askpass.sh not found in $HOME ."
72
72
ls -la " $HOME "
73
73
exit 1
74
74
fi
75
75
76
76
# Ensure it's executable since we just created it
77
- chmod +x " $GIT_ASKPASS "
77
+ chmod +x " $PATH_TO_GIT_ASKPASS "
78
78
79
79
# 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 " ; then
81
+ echo " $PATH_TO_GIT_ASKPASS is not executable."
82
+ ls -la " $PATH_TO_GIT_ASKPASS "
83
83
exit 1
84
84
fi
85
85
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 "
86
89
git push https://
[email protected] /cdr-oss/homebrew-core.git --all
87
90
88
91
# Find the docs for bump-formula-pr here
@@ -98,10 +101,14 @@ main() {
98
101
fi
99
102
100
103
# Clean up and remove homebrew-core
101
- cd ..
104
+ popd
102
105
rm -rf homebrew-core
103
106
104
- # TODO@jsjoeio - check that homebrew-core was removed
107
+ # Make sure homebrew-core is removed
108
+ if directory_exists " homebrew-core" ; then
109
+ echo " rm -rf homebrew-core failed."
110
+ ls -la
111
+ fi
105
112
}
106
113
107
114
main " $@ "
0 commit comments