Skip to main content
6 events
when toggle format what by license comment
Jan 7, 2021 at 11:18 comment added José González Late to the discussion, have you solved this? What about checking the number of parents of the current commit in git? This assumes any direct push to master contains only commits directly committed to master. Don't know if this is easy to check from a Jenkins pipeline, though.
Jun 27, 2020 at 4:17 comment added Max Cascone i'm sorry i haven't done exactly this yet but i can tell you from the json of the build, that the PR build contains "actions": [ { "_class": "hudson.model.CauseAction", "causes": [ { "_class": "jenkins.branch.BranchEventCause", "shortDescription": "Pull request #27 updated" } ], but the branch build only has "actions": [ { "_class": "hudson.model.CauseAction", "causes": [ { "_class": "jenkins.branch.BranchEventCause", "shortDescription": "Push event to branch PLATDEV-6356-pipe-template-2" } ] }, These are the same as shown at the very top of the build console output.
Jun 16, 2020 at 17:20 comment added Argyle Can you try including the following line in your pipeline: def build_cause = JSONArray.toList(currentBuild.getBuildCauses()) What is the value of build_cause._class[0] when the job is triggered from GitHub?
Jun 16, 2020 at 17:16 comment added Argyle Just wanted to clarify something before I provide another possible solution -- checking that the env.GITHUB_PR_STATE is CLOSE is not sufficient to detect that's it's a closed PR?
Jun 16, 2020 at 15:32 comment added Max Cascone Thanks, but this only shows the env vars of a PR 'branch', ie the job that's created when you pull a PR. As I mentioned i know how to find the values of the source/target branch. What i'm looking for is some way to tell if the master build that's happening is a result of a PR merge/closure, or just a regular ol' push to master (which is discouraged, but could happen - in which case I don't want to tag). I've tried to use currentBuild.getBuildCauses() but it only shows "push even to master", which i think applies to any merge to master. I'm only looking for PR merges.
Jun 16, 2020 at 8:55 history answered Argyle CC BY-SA 4.0