I want to trigger a Jenkins job after a new branch has been created and then populated via a push.
For example I would do something like this:
git checkout -b jdd_debug_branch_create_a
git push --set-upstream origin jdd_debug_branch_create_a
On the Jenkins server I see the following json snippet being delivered via a push event from a GitHub generic web hook.
{
"ref":"refs/heads/jdd_debug_branch_create_a",
"before":"0000000000000000000000000000000000000000",
"after":"b3df70cf4ac43b37b69c36560487d3aaaa352580"
}
Is it reasonable to assume a push event where the before ref is all zero's and the after ref is non-zero would be the first time a push to this new branch has occurred?
If not is there an other way to detect when the first push to new branch is made?