YETUS-511. github PR handler shouldn't use raw numbers
Signed-off-by: Sean Busbey <busbey@apache.org>
diff --git a/asf-site-src/source/documentation/in-progress/precommit-basic.md b/asf-site-src/source/documentation/in-progress/precommit-basic.md
index ef71513..b6b99aa 100644
--- a/asf-site-src/source/documentation/in-progress/precommit-basic.md
+++ b/asf-site-src/source/documentation/in-progress/precommit-basic.md
@@ -241,7 +241,7 @@
test-patch has some basic support for Github. test-patch supports many forms of providing pull requests to work on:
```bash
-$ test-patch.sh --github-repo=apache/pig 99
+$ test-patch.sh --github-repo=apache/pig GH:99
```
or
diff --git a/precommit/test-patch.d/github.sh b/precommit/test-patch.d/github.sh
index 3b01b26..18a0851 100755
--- a/precommit/test-patch.d/github.sh
+++ b/precommit/test-patch.d/github.sh
@@ -103,7 +103,7 @@
GITHUB_BRIDGED=true
yetus_debug "github_jira_bridge: Checking url ${urlfromjira}"
github_breakup_url "${urlfromjira}"
- github_locate_patch "${GITHUB_ISSUE}" "${fileloc}"
+ github_locate_patch GH:"${GITHUB_ISSUE}" "${fileloc}"
}
## @description given a URL, break it up into github plugin globals
@@ -222,6 +222,15 @@
verify_valid_branch "${PATCH_BRANCH}"
}
+## @description Given input = GH:##, download a patch to output.
+## @description Also sets GITHUB_ISSUE to the raw number.
+## @audience private
+## @stability evolving
+## @replaceable no
+## @param input
+## @param output
+## @return 0 on success
+## @return 1 on failure
function github_locate_patch
{
declare input=$1
@@ -233,6 +242,11 @@
return 1
fi
+ if [[ ! "${input}" =~ ^GH: ]]; then
+ return 1
+ fi
+
+ input=${input#GH:}
# https://github.com/your/repo/pull/##
if [[ ${input} =~ ^${GITHUB_BASE_URL}.*/pull/[0-9]+$ ]]; then