Skip to content

Commit efc9469

Browse files
committed
gh-reset-repo: Fix extraction of repository name
The parsing using `awk` is faulty assuming no colon sign (`:`). Extract the `<org>/<name>` as the repository name correctly. Signed-off-by: Razvan Deaconescu <razvan@rosedu.org>
1 parent 1e0a37c commit efc9469

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

gh-reset-repo.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ reset_branch_to_remote main true-origin
5151
git push --force upstream main
5252

5353
# Close all pull requests.
54-
gh repo set-default $(git remote show upstream | grep 'Fetch URL' | awk -F ':' '{print $3;}')
54+
repo_name=$(git remote show upstream | grep 'Fetch URL' | sed 's/\.git//' | rev | awk -F '[/:]' '{print $1"/"$2;}' | rev)
55+
gh repo set-default "$repo_name"
5556
for pr in $(gh pr list --json number | jq '.[] | values[]'); do
5657
gh pr close "$pr" -d
5758
done

0 commit comments

Comments
 (0)