{"id":38179180,"url":"https://github.com/earentir/gitearelease","last_synced_at":"2026-01-16T23:43:03.961Z","repository":{"id":162556380,"uuid":"637082128","full_name":"earentir/gitearelease","owner":"earentir","description":"Access gitea releases over the API","archived":false,"fork":false,"pushed_at":"2026-01-13T07:45:37.000Z","size":8254,"stargazers_count":0,"open_issues_count":2,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-13T10:35:42.221Z","etag":null,"topics":["gitea","gogs","release","version"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/earentir.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":"SECURITY.md","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":"2023-05-06T13:00:37.000Z","updated_at":"2026-01-13T07:45:34.000Z","dependencies_parsed_at":"2024-01-20T15:26:23.335Z","dependency_job_id":"f1ad992f-3190-40f3-8031-53c87f0dd867","html_url":"https://github.com/earentir/gitearelease","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/earentir/gitearelease","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/earentir%2Fgitearelease","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/earentir%2Fgitearelease/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/earentir%2Fgitearelease/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/earentir%2Fgitearelease/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/earentir","download_url":"https://codeload.github.com/earentir/gitearelease/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/earentir%2Fgitearelease/sbom","scorecard":{"id":727913,"data":{"date":"2025-08-22T11:04:41Z","repo":{"name":"github.com/earentir/gitearelease","commit":"0b7bd7d80d5b7c7bc2882db6b8170048fcf55f2d"},"scorecard":{"version":"v5.2.1","commit":"ab2f6e92482462fe66246d9e32f642855a691dc1"},"score":8.7,"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/ab2f6e92482462fe66246d9e32f642855a691dc1/docs/checks.md#packaging"}},{"name":"Token-Permissions","score":10,"reason":"GitHub workflow tokens follow principle of least privilege","details":["Info: jobLevel 'contents' permission set to 'read': .github/workflows/codeql.yml:20","Info: topLevel permissions set to 'read-all': .github/workflows/codeql.yml:11","Info: topLevel 'contents' permission set to 'read': .github/workflows/dependency-review.yml:13","Info: topLevel permissions set to 'read-all': .github/workflows/scorecard.yml:18","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/ab2f6e92482462fe66246d9e32f642855a691dc1/docs/checks.md#token-permissions"}},{"name":"Code-Review","score":-1,"reason":"Found no human activity in the last 15 changesets","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/ab2f6e92482462fe66246d9e32f642855a691dc1/docs/checks.md#code-review"}},{"name":"Pinned-Dependencies","score":10,"reason":"all dependencies are pinned","details":["Info:   9 out of   9 GitHub-owned GitHubAction dependencies pinned","Info:   4 out of   4 third-party GitHubAction dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/ab2f6e92482462fe66246d9e32f642855a691dc1/docs/checks.md#pinned-dependencies"}},{"name":"Maintained","score":10,"reason":"24 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 10","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/ab2f6e92482462fe66246d9e32f642855a691dc1/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/ab2f6e92482462fe66246d9e32f642855a691dc1/docs/checks.md#dangerous-workflow"}},{"name":"Security-Policy","score":10,"reason":"security policy file detected","details":["Info: security policy file detected: SECURITY.md:1","Info: Found linked content: SECURITY.md:1","Info: Found disclosure, vulnerability, and/or timelines in security policy: SECURITY.md:1","Info: Found text in security policy: SECURITY.md:1"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/ab2f6e92482462fe66246d9e32f642855a691dc1/docs/checks.md#security-policy"}},{"name":"Dependency-Update-Tool","score":10,"reason":"update tool detected","details":["Info: detected update tool: Dependabot: .github/dependabot.yml:1"],"documentation":{"short":"Determines if the project uses a dependency update tool.","url":"https://github.com/ossf/scorecard/blob/ab2f6e92482462fe66246d9e32f642855a691dc1/docs/checks.md#dependency-update-tool"}},{"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/ab2f6e92482462fe66246d9e32f642855a691dc1/docs/checks.md#binary-artifacts"}},{"name":"Fuzzing","score":10,"reason":"project is fuzzed","details":["Info: GoBuiltInFuzzer integration found: gitealease_fuzz_test.go:9"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/ab2f6e92482462fe66246d9e32f642855a691dc1/docs/checks.md#fuzzing"}},{"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/ab2f6e92482462fe66246d9e32f642855a691dc1/docs/checks.md#signed-releases"}},{"name":"CII-Best-Practices","score":5,"reason":"badge detected: Passing","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/ab2f6e92482462fe66246d9e32f642855a691dc1/docs/checks.md#cii-best-practices"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: GNU General Public License v2.0: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/ab2f6e92482462fe66246d9e32f642855a691dc1/docs/checks.md#license"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/ab2f6e92482462fe66246d9e32f642855a691dc1/docs/checks.md#vulnerabilities"}},{"name":"SAST","score":10,"reason":"SAST tool is run on all commits","details":["Info: SAST configuration detected: CodeQL","Info: all commits (30) are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/ab2f6e92482462fe66246d9e32f642855a691dc1/docs/checks.md#sast"}},{"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/ab2f6e92482462fe66246d9e32f642855a691dc1/docs/checks.md#branch-protection"}},{"name":"Contributors","score":0,"reason":"project has 0 contributing companies or organizations -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project has a set of contributors from multiple organizations (e.g., companies).","url":"https://github.com/ossf/scorecard/blob/ab2f6e92482462fe66246d9e32f642855a691dc1/docs/checks.md#contributors"}},{"name":"CI-Tests","score":10,"reason":"15 out of 15 merged PRs checked by a CI test -- score normalized to 10","details":null,"documentation":{"short":"Determines if the project runs tests before pull requests are merged.","url":"https://github.com/ossf/scorecard/blob/ab2f6e92482462fe66246d9e32f642855a691dc1/docs/checks.md#ci-tests"}}]},"last_synced_at":"2025-08-22T13:26:03.110Z","repository_id":162556380,"created_at":"2025-08-22T13:26:03.110Z","updated_at":"2025-08-22T13:26:03.110Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28487929,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-16T22:54:02.790Z","status":"ssl_error","status_checked_at":"2026-01-16T22:50:10.344Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["gitea","gogs","release","version"],"created_at":"2026-01-16T23:43:03.181Z","updated_at":"2026-01-16T23:43:03.955Z","avatar_url":"https://github.com/earentir.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gitearelease\n\n`gitearelease` is a Go package for fetching repository and release metadata from Git hosting platforms (Gitea, GitHub, GitLab), with built‑in version comparison utilities and configurable HTTP timeouts.\n\n---\n\n## Installation\n\n```bash\ngo get github.com/earentir/gitearelease\n```\n\n---\n\n## Public API\n\n### `SetHTTPTimeout(d time.Duration)`\nOverride the package‑wide HTTP client timeout. If `d \u003c= 0`, resets to the default of 15 s.\n\n```go\n// set a 30 s timeout\ngitearelease.SetHTTPTimeout(30 * time.Second)\n```\n\n---\n\n### `GetRepositories(cfg RepositoriesToFetch) ([]Repository, error)`\nFetches the list of repositories for a user.\n\n**Parameters**:\n- `cfg.BaseURL string` – your Gitea server base (e.g. `https://gitea.example.com`).\n- `cfg.User string` – the username or organization.\n- `cfg.WithReleas bool` – legacy filter; if true, only repos with releases.\n- `cfg.WithReleases bool` – preferred filter; if true, only repos with releases.\n\n**Returns**:\n- `[]Repository` – each repo has at least:\n  - `ID int`\n  - `ReleaseCounter int`\n  - `Owner` metadata (login, timestamps, etc.)\n  - other JSON fields are ignored on unmarshal.\n- `error` on network, JSON, or HTTP status failures.\n\n```go\nrepos, err := gitearelease.GetRepositories(\n    gitearelease.RepositoriesToFetch{\n        BaseURL:      \"http://gitea.local\",\n        User:         \"alice\",\n        WithReleases: true,\n    },\n)\n```\n\n---\n\n### `GetReleases(cfg ReleaseToFetch) ([]Release, error)`\nRetrieves all releases or just the latest for a given repository.\n\n**Parameters**:\n- `cfg.BaseURL string` – Gitea server base URL.\n- `cfg.User string` – owner of the repo.\n- `cfg.Repo string` – repository name.\n- `cfg.Latest bool` – if true, only the latest release is fetched.\n\n**Returns**:\n- `[]Release` – each entry includes:\n  - `ID, TagName, Name, Body, URL, HTMLURL, TarballURL, ZipballURL`\n  - `Draft, Prerelease, CreatedAt, PublishedAt`\n  - `Author` (login, email, full name)\n  - `Assets` (ID, Name, Size, DownloadCount, CreatedAt, UUID, BrowserDownloadURL, Type)\n- `error` on network, JSON, or HTTP status failures.\n\n```go\nrels, err := gitearelease.GetReleases(\n    gitearelease.ReleaseToFetch{\n        BaseURL: \"http://gitea.local\",\n        User:    \"alice\",\n        Repo:    \"project\",\n        Latest:  true,\n    },\n)\n```\n\n---\n\n### `TrimVersionPrefix(v string) string`\nRemoves common prefixes (`v`, `version`, `rel`, etc.) from a version string. Used internally by `CompareVersions` before parsing version numbers and suffixes.\n\n```go\nclean := gitearelease.TrimVersionPrefix(\"v1.2.3\") // \"1.2.3\"\nclean := gitearelease.TrimVersionPrefix(\"v1.0.0-commithash\") // \"1.0.0-commithash\"\n```\n\n---\n\n### `CompareVersions(v VersionStrings) int`\nCompares two version strings (after trimming prefixes). Supports version suffixes like `-commithash`.\n\n**Parameters**:\n- `v.Own string` – your current version.\n- `v.Latest string` – the target version to compare against.\n- prefixes are stripped before numeric comparison.\n- suffixes (e.g., `-abc123`, `-beta`) are compared lexicographically after numeric parts.\n\n**Returns**:\n- `-1` if `Own \u003c Latest`\n- `0`  if `Own == Latest`\n- `1`  if `Own \u003e Latest`\n\n**Examples**:\n- `v1.0.0` vs `v1.0.1` → -1\n- `v1.0.0-abc123` vs `v1.0.0-def456` → -1 (\"abc123\" \u003c \"def456\")\n- `v1.0.0-zebra` vs `v1.0.0-apple` → 1 (\"zebra\" \u003e \"apple\")\n\n```go\nres := gitearelease.CompareVersions(\n    gitearelease.VersionStrings{Own: \"1.0.0\", Latest: \"1.2.0\"},\n)\n// res == -1\n```\n\n---\n\n### `CompareVersionsHelper(v VersionStrings) string`\nA convenience wrapper around `CompareVersions` that returns a custom message.\n\n**Parameters** (in addition to `Own` and `Latest`):\n- `v.VersionStrings.Older` – message when own is older.\n- `v.VersionStrings.Equal` – message when equal (only if `ShowMessageOnCurrent` is true).\n- `v.VersionStrings.Newer` – message when own is newer.\n- `v.VersionStrings.UpgradeURL` – optional URL to include in `Older` message.\n- `v.VersionOptions.DieIfOlder`/`DieIfNewer` – if set, prints the message and exits with code 125.\n- `v.VersionOptions.ShowMessageOnCurrent` – whether to return the `Equal` message.\n\n```go\nvs := gitearelease.VersionStrings{\n    Own:    \"1.0.0\",\n    Latest: \"1.2.0\",\n    VersionStrings: gitearelease.VersionStrings{\n        Older:   \"Please update!\",\n        Equal:   \"You are up to date.\",\n        Newer:   \"You are ahead.\",\n    },\n    VersionOptions: gitearelease.VersionOptions{\n        ShowMessageOnCurrent: true,\n    },\n}\nmsg := gitearelease.CompareVersionsHelper(vs)\n```\n\n---\n\n## Examples\n\n### Provider-Specific Examples\n\nEach example demonstrates the provider's capabilities and documents any limitations:\n\n- **[Gitea Example](examples/gitea/main.go)**: Full-featured example showing Gitea-specific advantages\n  - Accurate `ReleaseCounter`\n  - Complete asset information (Size, DownloadCount, UUID, CreatedAt)\n  - All repository metadata fields\n  - Native `/releases/latest` endpoint\n\n- **[GitHub Example](examples/github/main.go)**: Example using GitHub API\n  - Near-complete feature support\n  - Note: `ReleaseCounter` is a placeholder (1 if releases exist)\n\n- **[GitLab Example](examples/gitlab/main.go)**: Example using GitLab API with limitations noted\n  - Basic release/repository functionality\n  - Note: Missing `ReleaseCounter`, asset details, draft/prerelease flags\n\n### Original Example\n\nSee [examples/main.go](examples/main.go) for the original full sample that:\n\n1. Lists repos\n1. Fetches the latest release\n1. Compares versions\n1. Iterates all releases and inspects assets\n\n---\n\n## Dependancies \u0026 Documentation\n[![Go Mod](https://img.shields.io/github/go-mod/go-version/earentir/gitearelease)]()\n\n[![Go Reference](https://pkg.go.dev/badge/github.com/earentir/gitearelease.svg)](https://pkg.go.dev/github.com/earentir/gitearelease)\n\n[![Dependancies](https://img.shields.io/librariesio/github/earentir/gitearelease)](https://libraries.io/github/earentir/gitearelease)\n\n[![OpenSSF Best Practices](https://www.bestpractices.dev/projects/8581/badge)](https://www.bestpractices.dev/projects/8581)\n\n[![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/earentir/gitearelease/badge)](https://securityscorecards.dev/viewer/?uri=github.com/earentir/gitearelease)\n\n![Code Climate issues](https://img.shields.io/codeclimate/tech-debt/earentir/gitearelease)\n\n---\n\n## Contributing\n\nContributions are always welcome!\nAll contributions are required to follow the https://google.github.io/styleguide/go/\n\nAll code contributed must include its tests in (_test) and have a minimum of 80% coverage\n\n---\n\n## Vulnerability Reporting\n\nPlease report any security vulnerabilities to the project using issues or directly to the owner.\n\n---\n\n## Code of Conduct\n This project follows the go project code of conduct, please refer to https://go.dev/conduct for more details\n\n ---\n\n## Multi-Provider Support\n\nThis package now supports **Gitea**, **GitHub**, and **GitLab**! Provider detection is automatic based on the `BaseURL`, but you can also explicitly specify the provider.\n\n### Auto-Detection\n\nThe package automatically detects the provider from the `BaseURL`:\n\n```go\n// GitHub - automatically detected\nreleases, err := gitearelease.GetReleases(gitearelease.ReleaseToFetch{\n    BaseURL: \"https://api.github.com\",\n    User:    \"golang\",\n    Repo:    \"go\",\n    Latest:  true,\n})\n\n// GitLab - automatically detected\nreleases, err := gitearelease.GetReleases(gitearelease.ReleaseToFetch{\n    BaseURL: \"https://gitlab.com\",\n    User:    \"gitlab-org\",\n    Repo:    \"gitlab\",\n    Latest:  true,\n})\n\n// Gitea - automatically detected (or default)\nreleases, err := gitearelease.GetReleases(gitearelease.ReleaseToFetch{\n    BaseURL: \"https://gitea.com\",\n    User:    \"earentir\",\n    Repo:    \"gitearelease\",\n    Latest:  true,\n})\n```\n\n### Explicit Provider Selection\n\nYou can explicitly specify the provider:\n\n```go\n// Explicitly specify GitHub\nreleases, err := gitearelease.GetReleases(gitearelease.ReleaseToFetch{\n    BaseURL:  \"https://api.github.com\",\n    User:     \"golang\",\n    Repo:     \"go\",\n    Latest:   true,\n    Provider: \"github\", // \"gitea\", \"github\", or \"gitlab\"\n})\n```\n\n### BaseURL Format\n\n- **GitHub**: Use `https://api.github.com` or `https://github.com` (auto-converted)\n- **GitLab**: Use `https://gitlab.com/api/v4` or `https://gitlab.com` (auto-converted)\n- **Gitea**: Use your Gitea instance URL (e.g., `https://gitea.com`)\n\n### Backward Compatibility\n\nAll existing code continues to work without changes! The package defaults to Gitea behavior when no provider is specified, ensuring full backward compatibility.\n\n### Provider Differences\n\n⚠️ **Important**: Not all features are available on all providers. See [PROVIDER_DIFFERENCES.md](PROVIDER_DIFFERENCES.md) for detailed information.\n\n**Quick Summary**:\n- **Gitea**: Full feature support (most complete)\n- **GitHub**: Near-complete support (ReleaseCounter is placeholder)\n- **GitLab**: Limited support (missing ReleaseCounter, asset details, draft/prerelease flags)\n\n**Key Differences**:\n- `ReleaseCounter`: Only accurate for Gitea (placeholder for GitHub, unavailable for GitLab)\n- Asset information: Complete for Gitea/GitHub, limited for GitLab (missing size, download count)\n- Draft/Prerelease: Fully supported for Gitea/GitHub, not supported for GitLab\n- Repository metadata: Complete for Gitea/GitHub, limited for GitLab\n\nSee the examples directory for provider-specific usage examples.\n\n## Roadmap\n\n- Create a finalised version 1 of the package\n- Add support for downloading binaries from releases\n\n---\n\n## Authors\n\n- [@earentir](https://www.github.com/earentir)\n\n---\n\n## License\n\nI will always follow the Linux Kernel License as primary, if you require any other OPEN license please let me know and I will try to accomodate it.\n\n[![License](https://img.shields.io/github/license/earentir/gitearelease)](https://opensource.org/license/gpl-2-0)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fearentir%2Fgitearelease","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fearentir%2Fgitearelease","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fearentir%2Fgitearelease/lists"}