{"id":17289600,"url":"https://github.com/jsquyres/github-webhooks","last_synced_at":"2026-04-27T12:02:49.676Z","repository":{"id":149192301,"uuid":"80920377","full_name":"jsquyres/github-webhooks","owner":"jsquyres","description":"A collection of a few github webhooks that I use","archived":false,"fork":false,"pushed_at":"2018-03-31T16:51:25.000Z","size":42,"stargazers_count":0,"open_issues_count":2,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-12T22:47:16.188Z","etag":null,"topics":["github","php","webhooks"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jsquyres.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"COPYING","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":"2017-02-04T13:16:17.000Z","updated_at":"2018-03-31T16:51:24.000Z","dependencies_parsed_at":null,"dependency_job_id":"b3334a2d-8e88-488a-b3f8-b08af6144835","html_url":"https://github.com/jsquyres/github-webhooks","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jsquyres/github-webhooks","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jsquyres%2Fgithub-webhooks","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jsquyres%2Fgithub-webhooks/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jsquyres%2Fgithub-webhooks/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jsquyres%2Fgithub-webhooks/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jsquyres","download_url":"https://codeload.github.com/jsquyres/github-webhooks/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jsquyres%2Fgithub-webhooks/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32335297,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-26T23:26:28.701Z","status":"online","status_checked_at":"2026-04-27T02:00:06.769Z","response_time":128,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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","php","webhooks"],"created_at":"2024-10-15T10:35:17.587Z","updated_at":"2026-04-27T12:02:49.641Z","avatar_url":"https://github.com/jsquyres.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Some GitHub webhooks\n\nThese are simple, pure-PHP Github webhooks.\n\n# Why does this project exist?\n\nThis project exists as simple, standalone PHP scripts so that you can\nrun them in web hosting environments where you are unable to run\nadditional daemons.  For example, many simple web hosting packages\nallow arbitrary PHP web pages, but do not allow running standalone\nprocesses (such as a Ruby / Sinatra process) for more than a short\nperiod of time.\n\n# Installation\n\nInstallation is comprised of two parts:\n\n1. Installation on the web server\n1. Installation at github.com or GitHub Enterprise\n\n## Installation on the web server\n\n1. Copy the source files to a folder in a docroot somewhere.\n   * Edit the `*-config.inc` files to reflect the configuration that\n     you want.  There are comments in these files explaining each of\n     the options.\n   * You will need to set the name(s) of the GitHub repos for which\n     you want the script to respond.\n   * You will also need to set the `auth_token` value to be the\n     Personal Access Token (PAT) of a user who has commit access to each of\n     these repos.\n     * You can generate a Github PAT by visiting\n       https://github.com/settings/tokens and clicking the \"Generate\n       new tokens\" button in the top right (or\n       https://YOUR_GHE_SERVER/settings/tokens).\n     * For public repositories, the only permission that this PAT\n       needs is `repo:status`.\n     * For private repositories, it is important to select the outer\n       `repo` permission (\"full control of private repositories\").\n       This will automatically check all the sub-repo permissions as\n       well.  It is *not* sufficient to simply check all the sub-repo\n       permissions and leave the outer `repo` status unchecked.\n1. Configure your web server to deny client access to the\n   `*.inc` files.\n   * ***THIS IS NOT OPTIONAL***\n   * Failure to do so will expose your PAT!\n   * For example, you can create a `.htaccess` file in the same\n     directory to restrict access to your `*.inc` files containing:\n```xml\n\u003cFiles \"*\\.inc\"\u003e\n    Order allow,deny\n    Deny from all\n    Satisfy all\n\u003c/Files\u003e\n```\n\n## Installation at github.com / GitHub Enterprise\n\n1. On Github.com, create a custom webhook for your Git repo:\n   * The URL should be the URL of either of your newly-installed `.php` files (e.g., `https://SERVER_NAME/PATH/signed-off-by-checker.php`).\n   * The content type should be `application/json`.\n   * Select \"Let me select individual events.\"\n     * Check the \"Pull request\" event.\n     * You can choose to leave the \"Push\" event checked or not.\n   * Make the webhook active.\n1. When you create a webhook at github.com / your GHE server, it should send a \"ping\" request to the webhook to make sure it is correct.\n   * On your git repository's webhooks page, click on your webhook.\n   * On the resulting page, scroll down to the \"Recent Deliveries\" section.  The very first delivery will be the \"ping\" event.\n   * Click on the first delivery and check that the response code is 200.\n   * If everything is working properly, the output body should say\n     `Hello, Github ping!  I'm here!`.\n   * If you do not see the ping results, see below.\n1. Create a pull request to your Git repository.\n    * If all goes well, if your commits meet the criteria of the\n      webhook (e.g., if they all contain `Signed-off-by` tokens), you\n      should get a green check for each commit in the PR.\n   * If any commit(s) do *not* meet the webhook criteria, then that\n     that(those) commit(s) should get a red X, and the *last* commit\n     should also get a red X.\n   * If you don't see the CI results on the pull request, see below.\n\n## Troubleshooting\n\nCommon problems include:\n\n* Not seeing the Github ping.\n  * Check that the URL in your Github webhook is correct.\n  * If using an `https` URL, check that the certificate is\n    authenticate-able by Github (i.e., it's signed by a recognizable\n    CA, etc.)\n  * Try test surfing to the URL of your Github webhook yourself and\n    make sure it is working properly.  You should see:\n```\nUse /PATH/*.php as a WebHook URL in your Github repository settings.\n````\n\n* Not seeing the checker's results in the CI block on the PR\n  * Ensure that the PAT used is from a user that has commit access to\n    the repository.  If the PHP script is running properly and the\n    results don't appear in the PR CI section, *this is almost always\n    the problem*.\n  * Check the \"Recent deliveries\" section of your webhook's\n    configuration page and check the response body output from your\n    delivery.\n  * Click on a delivery hash to expand it; click the Response tab to\n    see the output from the PHP script.\n  * If all goes well, the last line of output should show a message\n    indicating that it has seen all the commits in the PR and all of\n    them passed.\n\n# The Webhooks\n\nThere are currently two webhooks available:\n\n1. \"Signed-off-by\" checker\n2. Committer and author email checker\n\n## Signed-off-by checker\n\nThis webhook does a simple check: it makes sure that each commit in\nthe PR contains the `Signed-off-by` token.  If a commit does not\ncontain this token, it fails the check.\n\n### Expanding the signed-off-by checker\n\nYou can expand this webhook easily.\n\nFor example, it may be desirable to look for specific signoffs.  E.g.,\nyou might want to look for signoffs from specific team leads when\njunior developers make PRs.\n\n## Committer and author email checker\n\nThis webhook checks for common errors in commit email addresses, and\nis easily expandable to include your own checks.\n\nBy default, this webhook checks that the commiter and author email addresses on each command do not contain:\n\n1. `root@`\n1. `localhost`\n1. `localdomain`\n\nThese three checks tend to catch newbie Git users who have forgotten\nto set their username and email address in their Git configuration.\n\n### Expanding the email checker\n\nIt may also be desirable to ensure other qualities about the committer\nand/or author emails.  For example:\n\n1. Ensure that the committer is a current employee in your\n   organization (we do this in my group at work).\n1. Ensure that both the author and committer use correct email address\n   (e.g., `username@mycompany.com` instead of\n   `username@some.internal.machine.name.mycompany.com`).\n\nAnd so on.\n\n# History\n\nThese two GitHub webhooks started their lives in separate GitHub\nrepositories:\n\n* https://github.com/jsquyres/signed-off-by-github-webhook\n* https://github.com/jsquyres/email-checker-github-webhook\n\nHowever, a huge chunk of code was shared between the two of them, so\nit made sense to unify the two into a single code base and a single\nrepo.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjsquyres%2Fgithub-webhooks","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjsquyres%2Fgithub-webhooks","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjsquyres%2Fgithub-webhooks/lists"}