{"id":15915563,"url":"https://github.com/kfatehi/github-webhook-jenkins-proxy","last_synced_at":"2026-05-03T02:39:25.876Z","repository":{"id":42672548,"uuid":"354410523","full_name":"kfatehi/github-webhook-jenkins-proxy","owner":"kfatehi","description":"A nodejs webserver that accepts github webhooks and feeds them to jenkins via its API and updates the commit via Github API for status (pending, pass, fail)","archived":false,"fork":false,"pushed_at":"2023-11-23T06:37:00.000Z","size":367,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-02T02:49:23.404Z","etag":null,"topics":["github-api","jenkins"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kfatehi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-04-03T22:53:37.000Z","updated_at":"2025-02-13T01:22:33.000Z","dependencies_parsed_at":"2024-10-28T15:40:11.773Z","dependency_job_id":"7cc7ee26-7544-4dbd-85ac-7783823b4d69","html_url":"https://github.com/kfatehi/github-webhook-jenkins-proxy","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kfatehi%2Fgithub-webhook-jenkins-proxy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kfatehi%2Fgithub-webhook-jenkins-proxy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kfatehi%2Fgithub-webhook-jenkins-proxy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kfatehi%2Fgithub-webhook-jenkins-proxy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kfatehi","download_url":"https://codeload.github.com/kfatehi/github-webhook-jenkins-proxy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246939177,"owners_count":20857916,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["github-api","jenkins"],"created_at":"2024-10-06T17:41:12.388Z","updated_at":"2026-05-03T02:39:20.854Z","avatar_url":"https://github.com/kfatehi.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# github-webhook-jenkins-proxy\n\nThe Jenkins Plugin called [ghprb-plugin](https://github.com/jenkinsci/ghprb-plugin) was failing to build dangly PRs (branch of a branch).\n\nIt was difficult to work on so instead I created this project to intercept the webhooks and create the jobs using Jenkins API from Node.js.\n\nThe end-goal is to publish status checks, which this project does as well.\n\nYou configure one or more profiles in the config.json, each of which can launch one or more Jenkins jobs for a given repository's incoming github webhook.\n\nThe jobs results are sent to the Github statuses API at which point they coalesce into a final pull-request/commit status of pass or failure.\n\n## Usage\n\nCreate config.json file (see below sections for more customization information) with at least one repository:\n\n```json\n{\n  \"listenPort\": 8080,\n  \"jenkinsPort\": 8081,\n  \"profiles\": [{\n    \"githubAuth\": \"personal access token with full 'repo' scope\",\n    \"jenkinsAuth\": \"youruser:yourapikey\",\n    \"jenkinsProject\": \"name of jenkins job for incoming webhooks to queue\",\n    \"repoOwner\": \"org name\",\n    \"repoName\": \"repo name\",\n    \"triggerPhrase\": \"a phrase to check for in pr comments to trigger a build\",\n  }]\n}\n```\n\n### Shared Keys\n\nConfig keys that are common among the profiles can be placed in the global scope, for example, you can put the repoOwner once in the global scope and omit defining it in the profiles\n\n\n## Install\n\nInstall npm packages:\n\n```\nnpm install\n```\n\nStart the proxy server\n\n`node webhook_interceptor.js`\n\nConfigure your github project's webhook setting:\n\n* Payload URL: `https://\u003cwebserver\u003e/ghprbhook/`\n* Content type: application/json\n* Select individual events: Issue comments, Pushes, Pull requests\n\n### Multi-project configuration\n\nScope: profile\n\nYou may want to invoke multiple projects at once.\n\n```\n    \"jenkinsProjects\": [\"myproject-rspec\", \"myproject-e2e\"],\n```\n\nThe results of these will be collected and added as checks to the pull request under test.\n\n### Slack\n\nScope: profile\n\nYou can provide this: \n\n```\n    \"slackAlertEndpoint\": \"https://hooks.slack.com/services/...\"\n```\n\n### Github-\u003eSlack User Mentions\n\nScope: global\n\nYou can configure slack user resolution and interpolation by providing a map like so:\n\n```\n  \"githubAccountSlackMemberMap\": {\n    \"kfatehi\": \"\u003c@U01923F21LG\u003e\",\n  }\n```\n\nYou can get your slack \"ID\" from the users' slack profiles.\n\n### Playwright Trace Linkers\n\nScope: global\n\nEffectively makes these projects' artifacts (at that path) public via secret key. Be sure to use SSL.\nYou can use this in combination with Playwright's trace writing feature which creates a series of folders with zip files in them.\nEnter the parent directory of those folders in the `path` key relative to the workspace.\n\n```\n\"playwrightTraceLinkers\": [{\n  \"project\": \"my-playwright-project\",\n  \"path\": \"my-traces-dir\"\n}]\n```\n\nNow browse the artifacts page and enter the folders with the traces in them.\nYou will see a link to playwright's trace viewer next to each zip.\nThe links that are generated are using a 1-hour TTL secret for the public links to artifacts.\n\n### Hooks\n\nScope: profile\n\nHooks can be used to perform additional behavior depending on the ref on a push event.\n\nThis is useful if you want pushes to \"main\" or \"master\" to be built. They are not built by default because the webhook payload is different from pull requests, so they are detected and handled separately with this hook concept.\n\n#### buildBranch\n\nIf you want to run all jenkinsProjects as usual, then defining the \"buildBranch\" key to match the \"refs/heads/[branch]\" will suffice:\n\n```\n\"refHooks\": {\n  \"refs/heads/master\": {\n    \"buildBranch\": \"master\",\n  }\n}\n```\n\n##### extraJenkinsProjects Hook\n\nCombine buildBranch with extraJenkinsProjects to include any extra jenkins projects that are NOT defined in the profile's jenkinsProjects but which should be included for this branch.\n\n```\n\"refHooks\": {\n  \"refs/heads/master\": {\n    \"buildBranch\": \"master\",\n    \"extraJenkinsProjects\": [\"master-only-project\"]\n  }\n}\n```\n\n#### exec\n\nUse exec for custom scripts. Failures are reported to slack if endpoint is defined. Jenkins is bypassed/irrelevant in this case, however the other hooks will still fire and behave as expected if defined.\n\n```\n\"refs/heads/master\": {\n  \"exec\": {\n    \"command\": \"cd /repo \u0026\u0026 some crazy merge push automation\"\n  }\n}\n```\n\n## API\n\n### POST /build-all\n\nBuild all projects that match the given repository at the given commit\n\n`curl -XPOST -H\"Content-Type:application/json\" -d'{\"repo\":\"my/proj\", \"commit\":\"d0d353e1df3e97e234b93c381b4f55d1205e23e5\"}' https://jenkins.site/build-all`\n\n### POST /build-one\n\nBuild a single project that matches the given repository at the given commit\n\n`curl -XPOST -H\"Content-Type:application/json\" -d'{\"project\":\"e2e\", \"repo\":\"my/proj\", \"commit\":\"d0d353e1df3e97e234b93c381b4f55d1205e23e5\"}' https://jenkins.site/build-one`\n\n\n### POST /retry-one\n\nRetry a single project based on a provided build number\n\n`curl -XPOST -H\"Content-Type:application/json\" -d'{\"repo\":\"my/proj\", \"project\":\"e2e\", \"build\":\"552\"}' https://jenkins.site/retry-one`\n\n## Pages\n\n### GET /retry/:repoOrg/:repoName/:projectName/:buildNumber\n\nProvides a link to retry the specific build.\n\n#### Github Check Retry Userscript\n\nThe following userscript can be used to put a retry button on failed checks.\n\nThis will take you to the aforementioned page within the proxy from which a retry of that specific check can be requested.\n\n```\nJENKINS_SITE=\"https://jenkins.site\"\nfunction check() {\n  document.querySelectorAll('.merge-status-item [title=failed]').forEach(a=\u003e{\n    if (!a.querySelector('a')) {\n      let detailsURL = a.parentElement.querySelector('a.status-actions').href;\n      let detailParts = detailsURL.split('/').filter(b=\u003eb!=='')\n      let [projectName, buildNumber] = detailParts.slice(detailParts.length-2, detailParts.length)\n      let [repoOrg, repoName] = window.location.pathname.split('/').filter(b=\u003eb!=='').slice(0,2)\n      let link = document.createElement(\"a\")\n      link.target = \"_blank\"\n      link.innerText = \"Retry\"\n      link.href = `${JENKINS_SITE}/retry/${repoOrg}/${repoName}/${projectName}/${buildNumber}`\n      a.appendChild(link)\n    }\n  })\n}\n\nsetInterval(check, 1000)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkfatehi%2Fgithub-webhook-jenkins-proxy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkfatehi%2Fgithub-webhook-jenkins-proxy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkfatehi%2Fgithub-webhook-jenkins-proxy/lists"}