Jenkins set github commit status not working

if you're following the steps in the link you shared, you might have missed a critical step after step 9 (Set Github commit status) which is to select the second option in the Status result options in the What section as shown below:

Post build action -> Set Github commit status (universal)

This would allow you to send the default status messages (error, failed, success, pending) for each build. Selecting the first option would require you to manually define which status you want to send back (which is none by default and might explain why you're not receiving anything).

Also be sure to verify that your payload url in Webhook section on Github is configured correctly with your generated token. I think you've done that well anyway.

Payload Configuration

You can select Let me choose individual events to have more control over what Jenkins can send but be sure to make sure repo:status option is ticked. Hope that helps.


For debugging, Use below CLI command to check whether your access token is able to set the status in GitHub for any dummy_test PR.

curl "https://api.github.com/repos/[organization name]/[repo name]/statuses/[commit id]?access_token=[GitHub access token]" -H "Content-Type: application/json"   -X POST -d "{\"state\": \"success\", \"description\": \"Build Successful \", \"target_url\": \"[jenkins job url]\", \"context\": \"[Job name]\" }"

PS: Remove square braces

Tags:

Git

Jenkins