{"id":20705342,"url":"https://github.com/whosonfirst/go-writer-github","last_synced_at":"2025-12-24T02:14:39.095Z","repository":{"id":52604838,"uuid":"223521082","full_name":"whosonfirst/go-writer-github","owner":"whosonfirst","description":"GitHub API support for the go-writer Writer interface.","archived":false,"fork":false,"pushed_at":"2025-10-10T16:17:09.000Z","size":12213,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-11-22T17:20:34.340Z","etag":null,"topics":["github","golang","whosonfirst","whosonfirst-writer"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/whosonfirst.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2019-11-23T02:49:17.000Z","updated_at":"2025-10-10T16:16:51.000Z","dependencies_parsed_at":"2023-01-30T02:15:51.908Z","dependency_job_id":"617786ca-69dd-4578-b286-a5aa56f036c8","html_url":"https://github.com/whosonfirst/go-writer-github","commit_stats":{"total_commits":49,"total_committers":4,"mean_commits":12.25,"dds":0.5102040816326531,"last_synced_commit":"fb6bb6b6ac3bc6b832797b3fd1b332c13be6baaf"},"previous_names":[],"tags_count":22,"template":false,"template_full_name":null,"purl":"pkg:github/whosonfirst/go-writer-github","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whosonfirst%2Fgo-writer-github","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whosonfirst%2Fgo-writer-github/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whosonfirst%2Fgo-writer-github/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whosonfirst%2Fgo-writer-github/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/whosonfirst","download_url":"https://codeload.github.com/whosonfirst/go-writer-github/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whosonfirst%2Fgo-writer-github/sbom","scorecard":{"id":1237481,"data":{"date":"2025-07-07","repo":{"name":"github.com/whosonfirst/go-writer-github","commit":"0f0e82488ad74b7d280ece9029976a2402f46506"},"scorecard":{"version":"v5.2.1-18-gbb9c347d","commit":"bb9c347dff6349d986baab6578a46d68a5524c62"},"score":2.8,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/bb9c347dff6349d986baab6578a46d68a5524c62/docs/checks.md#packaging"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/bb9c347dff6349d986baab6578a46d68a5524c62/docs/checks.md#token-permissions"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/bb9c347dff6349d986baab6578a46d68a5524c62/docs/checks.md#dangerous-workflow"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/bb9c347dff6349d986baab6578a46d68a5524c62/docs/checks.md#maintained"}},{"name":"Code-Review","score":0,"reason":"Found 0/28 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/bb9c347dff6349d986baab6578a46d68a5524c62/docs/checks.md#code-review"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/bb9c347dff6349d986baab6578a46d68a5524c62/docs/checks.md#cii-best-practices"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/bb9c347dff6349d986baab6578a46d68a5524c62/docs/checks.md#fuzzing"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/bb9c347dff6349d986baab6578a46d68a5524c62/docs/checks.md#binary-artifacts"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: BSD 3-Clause \"New\" or \"Revised\" License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/bb9c347dff6349d986baab6578a46d68a5524c62/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/bb9c347dff6349d986baab6578a46d68a5524c62/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'main'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/bb9c347dff6349d986baab6578a46d68a5524c62/docs/checks.md#branch-protection"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/bb9c347dff6349d986baab6578a46d68a5524c62/docs/checks.md#security-policy"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/bb9c347dff6349d986baab6578a46d68a5524c62/docs/checks.md#pinned-dependencies"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 3 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/bb9c347dff6349d986baab6578a46d68a5524c62/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":8,"reason":"2 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GO-2022-0635","Warn: Project is vulnerable to: GO-2022-0646"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/bb9c347dff6349d986baab6578a46d68a5524c62/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-09-12T01:00:11.145Z","repository_id":52604838,"created_at":"2025-09-12T01:00:11.145Z","updated_at":"2025-09-12T01:00:11.145Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":27992997,"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-12-24T02:00:07.193Z","response_time":83,"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","golang","whosonfirst","whosonfirst-writer"],"created_at":"2024-11-17T01:17:41.249Z","updated_at":"2025-12-24T02:14:39.088Z","avatar_url":"https://github.com/whosonfirst.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# go-writer-github\n\nGitHub API support for the [go-writer](https://github.com/whosonfirst/go-writer) `Writer` interface.\n\nThis package supersedes the [go-whosonfirst-readwrite-github](https://github.com/whosonfirst/go-whosonfirst-readwrite-github) package.\n\n## Documentation\n\nDocumentation is incomplete.\n\n## Example\n\n```\npackage main\n\nimport (\n\t\"context\"\n\t\"flag\"\n\t\"fmt\"\t\n\t\"io/ioutil\"\n\t\"strings\"\n\t\"time\"\n\n\t\"github.com/whosonfirst/go-writer/v3\"\n\t_ \"github.com/whosonfirst/go-writer-github/v3\"\t\t\n)\n\nfunc main() {\n\n\towner := \"example\"\n\trepo := \"example-repo\"\n\taccess_token := \"s33kret\"\n\tbranch := \"example\"\n\n\tctx := context.Background()\n\t\n\tsource := fmt.Sprintf(\"githubapi://%s/%s?access_token=%s\u0026branch=%s\", owner, repo, access_token, branch)\n\t\t\t\n\twr, _ := writer.NewWriter(ctx, source)\n\n\tnow := time.Now()\n\tmsg := fmt.Sprintf(\"This is a test: %v\", now)\n\t\n\tbr := strings.NewReader(msg)\n\tfh := ioutil.NopCloser(br)\n\n\twr.Write(ctx, \"TEST.md\", fh)\n}\n```\n\n_Error handling has been omitted for brevity._\n\n## URIs\n\nNote: The `githubapi-pr`, `githubapi-tree` and `githubapi-branch` URI schemes (and packages) developed independently to address specific needs. It is possible (desirable) that these three packages get merged in to a single scheme with specific query parameters. That has not happened yet.\n\n### githubapi\n\nThe `githubapi` scheme is used to publish individual documents to a Git repository using the GitHub API.\n\nThe URI structure for `go-writer-github` (API) writers is:\n\n| Component | Value | Notes |\n| --- | --- | --- |\n| Scheme | `githubapi` | |\n| Host | string | A valid GitHub owner or organization |\n| Path | string | A valid GitHub respository |\n| Query | | _described below_ |\n\nThe following query parameters are supported for `go-writer-github` writers:\n\n| Name | Value | Required | Notes |\n| --- | --- | --- | --- |\n| access_token | string | yes | A valid GitHub API access token |\n| branch | string | no | A valid Git repository branch. Default is `main`. |\n| prefix | string | no | An optional path to prepend URIs (for writing) with. |\n| new | string | no | A valid string for formatting new file commit messages. Default is `Created %s`. |\n| update | string | no | A valid string for formatting updated file commit messages. Default is `Updated %s`. |\n| retry-on-ratelimit | boolean (string) | no | If true and the writer encounters a GitHub rate-limit error trying to write data it will sleep until the \"reset\" time (published by GitHub) and retry the write operation. |\n| retry-on-conflict | boolean (string) | no | If true and the writer encounters a GitHub `409 Conflict` error trying to write data it will keep trying (by refreshing the current hash) until it succeeds, with the limits of the `?max-retry-attempts` flag. | \n| max-retry-attempts | int | no | Default is 10. If \u003c=0 then checks on the maximum number of retry attempts will be disabled. |\n\nFor example:\n\n```\ngithubapi://whosonfirst-data/whosonfirst-data-admin-us \\\n\t?access_token={access_token} \\\n\t\u0026branch=main\n```\n\n### githubapi-pr\n\nThe `githubapi-pr` scheme is used to write documents to a GitHub pull request using the GitHub API. Records are commited when when the writer's `Flush()` or `Close()` methods are called. The PR is created when the writer's `Close()` method is called.\n\nThe URI structure for `go-writer-github` (API Pull Request) writers is:\n\n| Component | Value | Notes |\n| --- | --- | --- |\n| Scheme | `githubapi-pr` | |\n| Host | string | A valid GitHub owner or organization |\n| Path | string | A valid GitHub respository |\n| Query | | _described below_ |\n\nThe following query parameters are supported for `githubapi-pr` writers:\n\n| Name | Value | Required | Notes |\n| --- | --- | --- | --- |\n| access_token | string | yes | A valid GitHub API access token |\n| branch | string | no | A valid Git repository branch. Default is `main`. |\n| prefix | string | no | An optional path to prepend URIs (for writing) with. |\n| pr-owner | string | no | The user or organization name where the pull request will be created. If empty will default to GitHub owner or organization defined in URI host field. |\n| pr-repo | string | no | The repository name where the pull request will be created. If empty will default to GitHub owner or organization defined in URI path field. |\n| pr-branch | string | yes | The name of branch that the pull request will be created for. _If `pr-branch` starts with the value of the `writer.BRANCH_UUID_PREFIX` constant (\"{prefix}-\") then that string will be replaced with the value of the current Unix timestamp followed by \"-\" followed by a new UUID (v4) string. For example if `pr-branch` is \"{prefix}-test\" it would become \"{TIMESTAMP}-{UUID}-test\"._ |\n| pr-title | string | yes | The title of the pull request being created. |\n| pr-description | string | yes | The description of the pull request being created. |\n| pr-author | string | no | The author of the pull request being created. If empty the name associated with the GitHub access token will be used (must not be empty). |\n| pr-email | string | no | The email address associated with the pull request being created. If empty the email address associated with the GitHub access token will be used (must not be empty). |\n| pr-ensure-repo | bool | no | If true then the existence of {pr_owner}/{pr_repo} will be checked. If it does not exist then it will be forked (and if necessary renamed) from the organization and repo defined in the URI Host and Path fields. |\n\nFor example:\n\n```\ngithubapi-pr://sfomuseum-data/sfomuseum-data-collection \\\n\t?access_token={access_token} \\\n\t\u0026branch=main \\\n\t\u0026prefix=data/ \\\n\t\u0026pr-branch=aaronc \\\n\t\u0026pr-title=testing \\\n\t\u0026pr-description=testing \\\n\t\u0026pr-email=aaron@localhost \\\n\t\u0026pr-repo=sfomuseum-data-testing \\\n\t\u0026pr-owner=aaronland \\\n\t\u0026ensure-repo=true\n```\n\nWhich might yield something like this:\n\n![](docs/images/go-writer-github-api-pr.png)\n\n### githubapi-tree\n\nThe `githubapi-tree` scheme is used to write multiple documents to a GitHub tree commit using the GitHub API. Documents are written is created when the writer's `Flush()` or `Close()` methods are called.\n\nThe URI structure for `go-writer-github` (API Pull Request) writers is:\n\n| Component | Value | Notes |\n| --- | --- | --- |\n| Scheme | `githubapi-tree` | |\n| Host | string | A valid GitHub owner or organization |\n| Path | string | A valid GitHub respository |\n| Query | | _described below_ |\n\nThe following query parameters are supported for `githubapi-tree` writers:\n\n| Name | Value | Required | Notes |\n| --- | --- | --- | --- |\n| access_token | string | yes | A valid GitHub API access token |\n| branch | string | no | A valid Git repository branch. Default is `main`. |\n| prefix | string | no | An optional path to prepend URIs (for writing) with. |\n| to-branch | string | yes | The name of branch that the pull request will be created for. _If `to-branch` starts with the value of the `writer.BRANCH_UUID_PREFIX` constant (\"{prefix}-\") then that string will be replaced with the value of the current Unix timestamp followed by \"-\" followed by a new UUID (v4) string. For example if `to-branch` is \"{prefix}-test\" it would become \"{TIMESTAMP}-{UUID}-test\"._ |\n| description | string | yes | The description of the pull request being created. |\n| author | string | no | The author of the pull request being created. If empty the name associated with the GitHub access token will be used (must not be empty). |\n| email | string | no | The email address associated with the pull request being created. If empty the email address associated with the GitHub access token will be used (must not be empty). |\n\nFor example:\n\n```\ngithubapi-tree://sfomuseum-data/sfomuseum-data-collection \\\n\t?access_token={access_token} \\\n\t\u0026branch=main \\\n\t\u0026prefix=data/ \\\n\t\u0026to-branch=testing \\\n\t\u0026description=testing \\\n\t\u0026email=aaron@localhost \n```\n\n### githubapi-branch\n\nThe `githubapi-branch` scheme is used to write multiple documents to a GitHub commit using the GitHub API, optionally merging and removing that branch when complete. Documents are written is created when the writer's `Flush()` or `Close()` methods are called. Branches are merged and removed when the writer's `Close()` method is called.\n\nThe URI structure for `go-writer-github` (API Pull Request) writers is:\n\n| Component | Value | Notes |\n| --- | --- | --- |\n| Scheme | `githubapi-branch` | |\n| Host | string | A valid GitHub owner or organization |\n| Path | string | A valid GitHub respository |\n| Query | | _described below_ |\n\nThe following query parameters are supported for `githubapi-branch` writers:\n\n| Name | Value | Required | Notes |\n| --- | --- | --- | --- |\n| access_token | string | yes | A valid GitHub API access token |\n| branch | string | no | A valid Git repository branch. Default is `main`. |\n| prefix | string | no | An optional path to prepend URIs (for writing) with. |\n| to-branch | string | yes | The name of branch that the pull request will be created for. _If `to-branch` starts with the value of the `writer.BRANCH_UUID_PREFIX` constant (\"{prefix}-\") then that string will be replaced with the value of the current Unix timestamp followed by \"-\" followed by a new UUID (v4) string. For example if `to-branch` is \"{prefix}-test\" it would become \"{TIMESTAMP}-{UUID}-test\"._ |\n| description | string | yes | The description of the pull request being created. |\n| author | string | no | The author of the pull request being created. If empty the name associated with the GitHub access token will be used (must not be empty). |\n| email | string | no | The email address associated with the pull request being created. If empty the email address associated with the GitHub access token will be used (must not be empty). |\n| merge | bool | no | Merge commits made to `to-branch` in to the main branch when the writer's `Close()` method is invoked. Default is false. |\n| remove-on-merge | bool | no | Remove the `to-branch` branch when the writer's `Close()` method is invoked. Default is false. |\n\nFor example:\n\n```\ngithubapi-branch://sfomuseum-data/sfomuseum-data-collection \\\n\t?access_token={access_token} \\\n\t\u0026branch=main \\\n\t\u0026prefix=data/ \\\n\t\u0026description=testing \\\n\t\u0026email=aaron@localhost \\\n\t\u0026to-commit=testing \\\n\t\u0026merge=true \\\n\t\u0026remove-on-merge=true\n```\n\n## See also\n\n* https://github.com/whosonfirst/go-writer\n* https://github.com/google/go-github\n* https://developer.github.com/v3/#authentication\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwhosonfirst%2Fgo-writer-github","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwhosonfirst%2Fgo-writer-github","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwhosonfirst%2Fgo-writer-github/lists"}