{"id":24737827,"url":"https://github.com/zanechua/comment-worker","last_synced_at":"2025-10-10T06:31:57.934Z","repository":{"id":188160683,"uuid":"678211479","full_name":"zanechua/comment-worker","owner":"zanechua","description":null,"archived":false,"fork":false,"pushed_at":"2024-03-30T07:15:46.000Z","size":80,"stargazers_count":23,"open_issues_count":2,"forks_count":12,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-03T17:08:18.415Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zanechua.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","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}},"created_at":"2023-08-14T02:56:28.000Z","updated_at":"2025-03-08T11:44:07.000Z","dependencies_parsed_at":"2024-03-30T08:24:18.058Z","dependency_job_id":"c84c6393-f5e7-4b58-bfa3-021a5981b8d1","html_url":"https://github.com/zanechua/comment-worker","commit_stats":null,"previous_names":["zanechua/comment-worker"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/zanechua/comment-worker","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zanechua%2Fcomment-worker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zanechua%2Fcomment-worker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zanechua%2Fcomment-worker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zanechua%2Fcomment-worker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zanechua","download_url":"https://codeload.github.com/zanechua/comment-worker/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zanechua%2Fcomment-worker/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279002966,"owners_count":26083489,"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","status":"online","status_checked_at":"2025-10-10T02:00:06.843Z","response_time":62,"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":[],"created_at":"2025-01-27T22:09:27.446Z","updated_at":"2025-10-10T06:31:57.606Z","avatar_url":"https://github.com/zanechua.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# comment-worker\n\n`comment-worker` is a Cloudflare worker that receives user-generated content and uploads it as data files to a GitHub and/or GitLab repository. In practice, this allows you to have dynamic content (e.g. blog post comments) as part of a fully static website, as long as your site automatically deploys on every push to GitHub and/or GitLab, as seen on GitHub Pages, GitLab Pages, Netlify and others.\n\nEssentially it is a direct replacement for [staticman](https://github.com/eduardoboucas/staticman) and is mostly API compatible.\n\nPlease see [Issue #1](https://github.com/zanechua/comment-worker/issues/1) for more info\n\n[![Deploy to Cloudflare Workers](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/zanechua/comment-worker)\n\n# Usage\n\n## Setup\n\nClick on the Deploy with Workers button above and follow through the steps to finish the setup.\n\nCreate a GitHub app by going to [https://github.com/settings/apps](https://github.com/settings/apps) with the permissions of the following:\n\n![GHA Permissions](https://github.com/zanechua/comment-worker/assets/4265429/a5b7e22d-fc15-4828-8289-b9de3958ee24)\n\nMake sure to generate the private key and download the pem file.\n\nInstall the app into the repository you are intending to use with `comment-worker`\n\nYou need to declare the following variables in the Cloudflare worker variable settings\n\n| key                      | example                                     | description                                                           |\n|--------------------------|---------------------------------------------|-----------------------------------------------------------------------|\n| GITHUB_APP_ID            | 123456                                      | App Id of GitHub App which will be committing to your repository      |\n| GITHUB_APP_PRIVATE_KEY   | -----BEGIN PRIVATE KEY-----...              | Private Key of GitHub App which will be committing to your repository |\n| GITHUB_ORGANIZATION_SLUG | org                                         | Organization name or username that the repository belongs to          |\n| GITHUB_REPOSITORY_SLUG   | repo-name                                   | Repository name                                                       |\n| GITHUB_REPOSITORY_BRANCH | main                                        | Branch where the site configuration lies                              |\n| CW_ALLOWED_ORIGINS       | https://example.com,https://www.example.com | Allowed origins that can send a request to the comment-worker         |\n| CW_DEBUG                 | false                                       | Turning debug mode on or off                                          |\n\nThe `GITHUB_APP_PRIVATE_KEY` needs to be in pkcs8 format, convert the key to pkcs8 format by following the `openssl` command below and input the private key with `\\n` as the separators for the line breaks.\n\n```bash\nopenssl pkcs8 -topk8 -inform PEM -outform PEM -nocrypt -in private-key.pem -out private-key-pkcs8.key\n```\n\nE.g. `GITHUB_APP_PRIVATE_KEY=-----BEGIN PRIVATE KEY-----\\nMIIEvQ...`\n\nAdd `staticman.yml` to the root of your repository on `GITHUB_REPOSITORY_BRANCH`. [Example](https://github.com/zanechua/website/blob/master/staticman.yml)\n\n## API\n\nPOST `https://your-worker-subdomain.workers.dev/api/handle/form`.\n\nSupport both `application/x-www-form-urlencoded` and `application/json` content types (must be specified in the `Content-Type` header).\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eJSON example\u003c/b\u003e\u003c/summary\u003e\n\n```json\n{\n  \"fields\": {\n    \"name\": \"John Doe\",\n    \"email\": \"johndoe@example.com\",\n    \"message\": \"Hello world!\",\n    \"slug\": \"your/page/slug\"\n  },\n  \"options\": {\n    \"url\": \"https://example.com\"\n  }\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eForm example\u003c/b\u003e\u003c/summary\u003e\n\n```html\n\u003cform\n  submit=\"https://your-worker-subdomain.workers.dev/api/handle/form\"\n  method=\"POST\"\n\u003e\n  \u003cdiv\u003e\n    \u003clabel for=\"fields[name]\"\u003eName\u003c/label\u003e\n    \u003cinput type=\"text\" name=\"fields[name]\" value=\"John Doe\" required\u003e\n  \u003c/div\u003e\n  \u003cdiv\u003e\n    \u003clabel for=\"fields[email]\"\u003eEmail\u003c/label\u003e\n    \u003cinput type=\"email\" name=\"fields[email]\" value=\"\" required\u003e\n  \u003c/div\u003e\n  \u003cdiv\u003e\n    \u003clabel for=\"options[url]\"\u003eWebsite\u003c/label\u003e\n    \u003cinput type=\"url\" name=\"options[url]\" placeholder=\"https://example.com\"\u003e\n  \u003cdiv\u003e\n    \u003clabel for=\"fields[message]\"\u003eMessage\u003c/label\u003e\n    \u003ctextarea name=\"fields[message]\" required\u003eHello world!\u003c/textarea\u003e\n  \u003c/div\u003e\n  \u003cdiv style=\"display: none\"\u003e\n    \u003clabel for=\"fields[slug]\"\u003eSlug\u003c/label\u003e\n    \u003cinput type=\"text\" name=\"fields[slug]\" value=\"your/page/slug\" readonly\u003e\n  \u003c/div\u003e\n\n  \u003cbutton type=\"submit\"\u003eSubmit\u003c/button\u003e\n  \u003cbutton type=\"reset\"\u003eReset\u003c/button\u003e\n\u003c/form\u003e\n```\n\n\u003c/details\u003e\n\n# Manual Deployment\n\nWe're using Cloudflare workers + wrangler to handle the deployments, we have to use wrangler due to the features we are using that requires wrangler to package the bundle up.\n\nYou need to run the deploy command with the `CLOUDFLARE_ACCOUNT_ID` and `CLOUDFLARE_API_TOKEN` variables before running the command.\n\nYou can use the `example config` section in the `wrangler.toml` for easier deployment to your cloudflare worker, just uncomment the section and replace with your own values\n\n```bash\nCLOUDFLARE_ACCOUNT_ID=abc CLOUDFLARE_API_TOKEN=abc pnpm wrangler deploy\n```\n\n# Development Setup\n\nFollow the setup section above first.\n\nCreate a `.dev.vars` at the root of the repository and the format should follow the `dotenv` format of `KEY=VALUE` and a new line for each of the environment variables\n\nRun the following to load up the app\n```bash\npnpm install\npnpm dev\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzanechua%2Fcomment-worker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzanechua%2Fcomment-worker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzanechua%2Fcomment-worker/lists"}