[jenkins] - when trying to determine the branchname of a detached head revision - filter it so only branches from the currently built GITHUB_REPO are used (else we might pick the wrong branchname from another repo which was checked out before and contains the same revision)
Merge pull request #5659 from Memphiz/fixjenkinsremotes

[jenkins] - fix wrong branchnames at times