Skip to content

Commit 2e487b8

Browse files
author
R. Tyler Croy
authored
Merge pull request jenkinsci#41 from kmadel/patch-1
Update access-repo-information.groovy
2 parents 55fec53 + d3674ff commit 2e487b8

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
#!groovy
22

33
// github-organization-plugin jobs are named as 'org/repo/branch'
4+
// we don't want to assume that the github-organization job is at the top-level
5+
// instead we get the total number of tokens (size)
6+
// and work back from the branch level Pipeline job where this would actually be run
7+
// Note: that branch job is at -1 because Java uses zero-based indexing
48
tokens = "${env.JOB_NAME}".tokenize('/')
5-
org = tokens[0]
6-
repo = tokens[1]
7-
branch = tokens[2]
9+
org = tokens[tokens.size()-3]
10+
repo = tokens[tokens.size()-2]
11+
branch = tokens[tokens.size()-1]
812

0 commit comments

Comments
 (0)