VSTS GitHub Pull Request Trigger Not Firing - github

I can't seem to get my VSTS build to trigger for GitHub pull requests. It works fine when i commit to the master branch, but not when i open the pull requests to the master branch.
Here's the screenshot from VSTS:
I can also see the 2x Webhooks in GitHub:
I can see the pull_request webhook fires successfully when i open a PR too (returns 200 ok), but VSTS doesn't seem to be triggering the build.
I'm guessing there's something obvious i've missed. Can someone help please?

As auto trigger is enabled only for master branch, I would suggest you add one more branch filter. Click on the add button and include other branches also.

Related

How can I configure Jenkins to run declarative Jenkinsfiles on GitHub Pull Request (PR) Close or Merge?

In a recent build of Jenkins (i.e., 2021-10-01 timeframe), how can I react to a GitHub pull request (PR) Close (or Merge) using declarative Jenkinsfiles and ONLY these "basic" Jenkins plugins?
GitHub plugin
GitHub branch source plugin
It seems that I should avoid GitHub Pull Request Builder since it can't react to PR close or merge.
Currently, everything works fine using a "GitHub organization" type project, when opening the PR and creating new commits on it (i.e., I see "continuous-integration/jenkins/pr-merge"), but when I click Close pull Request in GitHub, the Jenkins Build History doesn't react. I'm not sure why since, the "GitHub branch source plugin" states:
While the build triggers are often enough, you can set up webhooks to
automatically trigger builds when changes are pushed to your GitHub
repositories.

Github branch protection rules/status checks

I'd like to create a branch protection rule for our main branch in a way that if the "enforce-pr-naming-convention" github workflow fails for a pull request event, the pull request merge button should be disabled. Though the workflow is present in .github/workflows , was tested and works fine, I can't see & select it under settings/branches.
expectation:
https://i.stack.imgur.com/pmRPS.png
reality:
https://i.stack.imgur.com/SRoi6.png
Any idea on how to solve this?

Pull requests from forks does not trigger travis ci

We seem to have an issue merging pull requests which are from forks like here and here. Creating pull request from branches is totally fine and is being triggered by travis ci. Is there some settings which needs to be set for the travis CI? See the travis file here. Thanks.
Answer from travis team:
The checks on the links are branch builds. For them to work, the PR author needs to set up Travis integration for their repo, too, with travis-ci.com, and run a build for the tip of the PR branch. It is this build that the PR UI is “waiting for the status to be reported” of.
The check that would run in your repo is the PR build. It runs on a “merge preview” commit that Github autogenerates for PRs.
The types of the checks to run you configure in branch protection settings at Github.

github new local branch event for Jira webhook

I am noticing that when i create a new local branch, it doesn't get picked up in Github, and therefore the Jira webhook also doesn't create a transition trigger:
git branch -b new-local-branch
The Jira trigger is supposed to recognize "Branch created" event from Github webhook, but that doesn't exist until I push, which also then shows the new branch for the first time in the <>Code tab.
So, is this performing as expected, or is there another way to create a branch which gets pickedup without a push?
So, is this performing as expected
Yes: a webhook reacts to an event (here a push event).
As long as your branch remains local, said webhook has no reason to be activated.
But once created, you could push your branch immediately (before making any new commit in it): that would allow the webhook and Jira to pick up on it.
Is there another way to create a branch which gets picked-up without a push?
If you are creating your local branch from a commit which is already pushed, you could consider the reverse approach: creating your branch directly from GitHub web GUI. But that might not trigger the webhook though.

Jenkins and Github with forked pr commits

I'm having an issue setting up Github and Jenkins CI.
When a forked PR commits changes, github doesn't notify jenkins, even if I've accepted the PR from a forked repo. Only when I merge a pr from a forked repo into master will github trigger Jenkins.
So the credentials and ability is there, but I can't find the option in github to force ALL commits to the original repo (including forked pr's) trigger the CI, anybody any suggestions?
The solution was to use the Github Pull Request Builder Plugin
There are instructions in the link above that worked for me. As well as the default instructions I had to also do this:
"This build is parameterized" and add string parameter named "sha1". When starting build give the "sha1" parameter commit id you want to build or refname (eg: "origin/pr/9/head").
and I didn't use github hooks
A post-receive hook in GitHub would post to any listening service any received commit.
It isn't limited to a particular branch.
However, Jenkins can be set to monitor a specific branch.
Unless, as mentioned in "How can I make Jenkins CI with git trigger on pushes to master?", you configure your Jenkins CI to Poll from GitHub (in which case, it will listen to said Github hook, instead of doing a git pull on a specific branch.
The GitHub pull request builder plugin mentioned by the OP Coombesy 's answer is one other way to make Jenkins poll GitHub.