We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 55fec53 + d3674ff commit 2e487b8Copy full SHA for 2e487b8
pipeline-examples/github-org-plugin/access-repo-information.groovy
@@ -1,8 +1,12 @@
1
#!groovy
2
3
// 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
8
tokens = "${env.JOB_NAME}".tokenize('/')
- org = tokens[0]
- repo = tokens[1]
- branch = tokens[2]
9
+ org = tokens[tokens.size()-3]
10
+ repo = tokens[tokens.size()-2]
11
+ branch = tokens[tokens.size()-1]
12
0 commit comments