github-merge-pr: permit to target other repository name
[maintainer-tools.git] / github-merge-pr.sh
index e22f3df4155ee48c0d5e38338fc57f7342505316..7f23435a7c1e9885a54e3f38bdb45c2b74a425dc 100755 (executable)
@@ -6,10 +6,14 @@
 # 2. Make sure you can correctly push and force push to the github
 #    repository
 #
-# Usage: github-merge-pr.sh PR_NUMBER BRANCH
+# Usage: github-merge-pr.sh PR_NUMBER BRANCH REPO_NAME
+#
+# BRANCH is optional and defaults to main.
+# REPO_NAME is optional and defaults to openwrt. It does
+# describe the repository name to use to pull PR info from.
 
-# Github repository, just the name/repo part, no .git suffix, no base url!
-REPO="openwrt/openwrt"
+# Github repository owner or organization name.
+GITHUB_REPO_OWNER="openwrt"
 
 # Your repository token, generate this token at your profile page:
 # - Navigate to https://github.com/settings/tokens
@@ -23,8 +27,11 @@ REPO="openwrt/openwrt"
 
 PRID="$1"
 BRANCH="${2:-main}"
-DRY_RUN="$3"
+GITHUB_REPO_NAME="${3:-openwrt}"
+DRY_RUN="$4"
+
 GIT=git
+REPO="$GITHUB_REPO_OWNER"/"$GITHUB_REPO_NAME"
 
 yesno() {
        local prompt="$1"