Skip to content

Commit

Permalink
fix(chezmoi): init private repos - github auth check
Browse files Browse the repository at this point in the history
  • Loading branch information
scottames committed May 6, 2023
1 parent fd03d67 commit 6e0b58a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
3 changes: 2 additions & 1 deletion home/.chezmoiexternal.toml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@
refreshPeriod = "168h"

{{ end -}}
{{- if env "SSH_AUTH_SOCK" -}}
{{- if and (lookPath "is-github-authed.sh") (eq (output "is-github-authed.sh") "true") -}}

# ╭──────────────────────────────────────────────────────────╮
# │ git-repo │
# │ | personal │
Expand Down
11 changes: 11 additions & 0 deletions home/bin/executable_is-github-authed.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/env sh

ssh -T [email protected] >/dev/null 2>&1
exit_status=$?

if [ "${exit_status}" -ne 1 ] && [ "${exit_status}" -ne 0 ]; then
printf "false"
exit
fi

printf "true"
2 changes: 2 additions & 0 deletions home/private_dot_config/fish/conf.d/__is_has.fish
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ if [ $UNAME = "Linux" ]
set -g DISTRO "arch"
else if [ ($_cat /proc/version | grep Ubuntu) ]
set -g DISTRO "ubuntu"
else
set -g DISTRO "unknown"
end
else if [ $UNAME = "Darwin" ]
set -g IS_MAC true
Expand Down

0 comments on commit 6e0b58a

Please sign in to comment.