Update Jenkins build status in GitHub pull requests

I am trying to integrate GitHub and Jenkins via GitHub Actions selfhosted Runner yaml file (not via webhooks). I am looking solution to track back the Jenkins build status in GitHub pull requests.
I have explored many Jenkins plugins like GitHub Pull Request Builder, set GitHub commits via post build actions, etc. but its not working.
I am assuming as I am not using Web-hook, these plug-ins are not able to do their job.
Are there any other plugins / yaml script for this use-case?

runner yaml file:
name: Create Jenkins Links workflow

on: [push, pull_request]

runs-on: [self-hosted, Windows,my-runner]
JOB_ENV: True # This is accesible for the job
Jenkins_GITHUB_ENDPOINT: “https://rb-jmaas.de.bosch.com/PS-EC_Playground/github-webhook/
HEADER_CONTENT_TYPE: “Content-Type: application/json”
HEADER_GITHUB_EVENT: “x-github-event: ${{ github.event_name }}”

  - name: List Environment variables
    run: set
    shell: cmd
  - name: Invoke Jenkins endpoint
    shell: cmd
    run: | 

So you want run a GitHub action and that action will trigger a build in Jenkins?

Then follow the steps here How to build a job using the REST API and cURL? – CloudBees Support

I’m super curious why your not using webhooks. It is it some sort of security thing so the github action is running on a server inside your network and you want to still notify jenkins.

As far as I know, if your using the github branch source for your job, it should update the status back to github, doesn’t matter how its triggered.

1 Like

Yes it happens via Webhook. But not via GitHub actions runner directly.
In our case GitHub is on Cloud (Internet) & Jenkins is over Intranet. Due to some security & firewall settings Its not possible to use WebHooks. So Runner is in place.

What do you mean by runner? A GitHub Actions runner? Or the Jenkinsfile Runner?

So the Jenkins is being triggered and running the build? Or you are trying to trigger Jenkins to run the build?

This is pretty common setup, if you can’t open a connection for a webhook, then your only real option to trigger a build is with SCM polling, which isn’t really that bad as long as you use jitter so the polling doesn’t trigger all at once.

Sounds like they have a github actions agent connected to github, and that agent is turning around and curling/posting to jenkins.

I personally would still post to the /github-webhooks endpoint, I just don’t know the structure to use. i’m sure if you look at the github plugin tests you can see what structure is needed.

Is there an error message? What are you expecting it to do? What did it do?