Repository: yetus Updated Branches: refs/heads/master 3c28739fc -> 57fec23c5
YETUS-511. github PR handler shouldn't use raw numbers Signed-off-by: Sean Busbey <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/yetus/repo Commit: http://git-wip-us.apache.org/repos/asf/yetus/commit/57fec23c Tree: http://git-wip-us.apache.org/repos/asf/yetus/tree/57fec23c Diff: http://git-wip-us.apache.org/repos/asf/yetus/diff/57fec23c Branch: refs/heads/master Commit: 57fec23c5f2eeb6629fa73b395c31f6ed5e5e55a Parents: 3c28739 Author: Allen Wittenauer <[email protected]> Authored: Fri Jul 7 10:45:22 2017 -0700 Committer: Allen Wittenauer <[email protected]> Committed: Fri Jul 7 14:47:59 2017 -0700 ---------------------------------------------------------------------- .../documentation/in-progress/precommit-basic.md | 2 +- precommit/test-patch.d/github.sh | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/yetus/blob/57fec23c/asf-site-src/source/documentation/in-progress/precommit-basic.md ---------------------------------------------------------------------- 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.sh --jira-issue-re='^PROJECT-[0-9]+$' --jira-base-url='https://exam 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 http://git-wip-us.apache.org/repos/asf/yetus/blob/57fec23c/precommit/test-patch.d/github.sh ---------------------------------------------------------------------- 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 @@ function github_jira_bridge 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 @@ function github_determine_branch 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 @@ function github_locate_patch 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
