forked from clan/clan-core
tea-create-pr: Better username detection
This commit is contained in:
parent
adef52a938
commit
a8762522c8
@ -4,7 +4,6 @@
|
||||
coreutils,
|
||||
git,
|
||||
tea,
|
||||
gawk,
|
||||
openssh,
|
||||
}:
|
||||
writeShellApplication {
|
||||
@ -15,7 +14,6 @@ writeShellApplication {
|
||||
git
|
||||
tea
|
||||
openssh
|
||||
gawk
|
||||
];
|
||||
text = builtins.readFile ./script.sh;
|
||||
}
|
||||
|
@ -7,10 +7,12 @@ targetBranch="${3:-main}"
|
||||
shift && shift
|
||||
TMPDIR="$(mktemp -d)"
|
||||
currentBranch="$(git rev-parse --abbrev-ref HEAD)"
|
||||
user="$(git config --get remote.origin.url | awk -F'[@:/]' '{print $3}' | tr -d '\n')"
|
||||
user_unparsed="$(tea whoami)"
|
||||
user="$(echo "$user_unparsed" | tr -d '\n' | cut -f4 -d' ')"
|
||||
tempRemoteBranch="$user-$currentBranch"
|
||||
root_dir=$(git rev-parse --show-toplevel)
|
||||
|
||||
|
||||
# Function to check if a remote exists
|
||||
check_remote() {
|
||||
if git remote get-url "$1" > /dev/null 2>&1; then
|
||||
@ -29,6 +31,7 @@ if ! check_remote "$remoteUpstream"; then
|
||||
fi
|
||||
|
||||
upstream_url=$(git remote get-url "$remoteUpstream")
|
||||
git fetch "$remoteUpstream"
|
||||
repo=$(echo "$upstream_url" | sed -E 's#.*:([^/]+/[^.]+)\.git#\1#')
|
||||
|
||||
treefmt -C "$root_dir"
|
||||
|
Loading…
Reference in New Issue
Block a user