Skip to content

Commit f2be106

Browse files
committed
refactor: use GIT_ASKPASS as variable
1 parent e03dafb commit f2be106

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

ci/steps/brew-bump.sh

+9-7
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,13 @@ main() {
5858
git merge upstream/master
5959

6060
echo "Pushing changes to cdrci/homebrew-core fork on GitHub"
61+
62+
# GIT_ASKPASS lets us use the password when pushing without revealing it in the process list
63+
# See: https://serverfault.com/a/912788
64+
GIT_ASKPASS="$HOME/git-askpass.sh"
6165
# Source: https://serverfault.com/a/912788
6266
# shellcheck disable=SC2016,SC2028
63-
echo '#!/bin/sh\nexec echo "$HOMEBREW_GITHUB_API_TOKEN"' > "$HOME"/git-askpass.sh
67+
echo '#!/bin/sh\nexec echo "$HOMEBREW_GITHUB_API_TOKEN"' > "$GIT_ASKPASS"
6468

6569
# Make sure the git-askpass.sh file creation is successful
6670
if [[ $(file_exists "git-askpass.sh") -eq 1 ]]; then
@@ -70,18 +74,16 @@ main() {
7074
fi
7175

7276
# Ensure it's executable since we just created it
73-
chmod +x "$HOME/git-askpass.sh"
77+
chmod +x "$GIT_ASKPASS"
7478

7579
# Make sure the git-askpass.sh file is executable
76-
if [[ $(is_executable "$HOME/git-askpass.sh") -eq 1 ]]; then
80+
if [[ $(is_executable "$GIT_ASKPASS") -eq 1 ]]; then
7781
echo "git-askpass.sh is not executable."
78-
ls -la "$HOME/git-askpass.sh"
82+
ls -la "$GIT_ASKPASS"
7983
exit 1
8084
fi
8185

82-
# GIT_ASKPASS lets us use the password when pushing without revealing it in the process list
83-
# See: https://serverfault.com/a/912788
84-
GIT_ASKPASS="$HOME/git-askpass.sh" git push https://[email protected]/cdr-oss/homebrew-core.git --all
86+
git push https://[email protected]/cdr-oss/homebrew-core.git --all
8587

8688
# Find the docs for bump-formula-pr here
8789
# https://github.com/Homebrew/brew/blob/master/Library/Homebrew/dev-cmd/bump-formula-pr.rb#L18

0 commit comments

Comments
 (0)