github-merge-pr: fix loading .config if symbolic link is used
[maintainer-tools.git] / github-merge-pr.sh
index 16a661d2fb4fb28406ddb825e651be2015f526aa..dd08a89019cf78f41c9dc0a9a81fd45783a0b007 100755 (executable)
@@ -29,8 +29,11 @@ GITHUB_REPO_OWNER="openwrt"
 # Set this line in .config to use SSH key to rebase PR branch
 # GITHUB_USE_SSH=1
 
+SCRIPT_DIR="$(dirname $0)"
+[ -h $0 ] && SCRIPT_DIR="$(dirname $(readlink $0))"
+
 # Everything in .config will overwrite the default values set up
-[ -f  .config ] && source .config
+[ -f "$SCRIPT_DIR/.config" ] && source "$SCRIPT_DIR"/.config
 
 PRID="$1"
 BRANCH="${2:-main}"