github

package module
v0.0.0-...-445a489 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 11, 2025 License: MIT Imports: 4 Imported by: 0

README

github

Go Reference Go Report Card

go get git.gorbe.io/go/github@latest

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func LatestRelease

func LatestRelease(owner, repository string) (string, error)

LatestRelease returns the latest release name of owner/repository.

If response code is not 200, returns the status as error (eg.: "404 Not Found")

This function uses the following API endpoint:

https://api.github.com/repos/{{ .Owner }}/{{ .Repository }}/releases/latest
Example
package main

import (
	"fmt"
	"os"

	"git.gorbe.io/go/github"
)

func main() {

	release, err := github.LatestRelease("goreleaser", "goreleaser")
	if err != nil {
		fmt.Fprintf(os.Stderr, "Failed to get latest release: %s\n", err)
		os.Exit(1)
	}

	fmt.Printf("%s\n", release)
}
Output:

v2.7.0

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳