github

package
v0.2.30 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2026 License: Apache-2.0 Imports: 11 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func VerifySignature

func VerifySignature(payload []byte, signature string, secret string) bool

VerifySignature 验证 GitHub Webhook 签名 signature 格式: "sha256=<hex>"

Types

type Release

type Release struct {
	TagName    string `json:"tag_name"`
	Name       string `json:"name"`
	ZipballURL string `json:"zipball_url"`
	TarballURL string `json:"tarball_url"`
	Draft      bool   `json:"draft"`
	Prerelease bool   `json:"prerelease"`
}

Release GitHub Release 信息

type ReleaseDownloader

type ReleaseDownloader struct {
	// contains filtered or unexported fields
}

ReleaseDownloader GitHub Release 下载器

func NewReleaseDownloader

func NewReleaseDownloader() *ReleaseDownloader

NewReleaseDownloader 创建 Release 下载器

func (*ReleaseDownloader) DownloadReleaseZip

func (d *ReleaseDownloader) DownloadReleaseZip(zipballURL, targetDir, filename, token string) error

DownloadReleaseZip 下载 Release 并保存为指定文件名

func (*ReleaseDownloader) DownloadZipball

func (d *ReleaseDownloader) DownloadZipball(url, destPath, token string) error

DownloadZipball 下载 Release 的 zipball url: GitHub zipball URL (e.g., https://api.github.com/repos/owner/repo/zipball/v1.0.0) destPath: 目标文件路径

type ReleasePayload

type ReleasePayload struct {
	Action     string     `json:"action"`
	Release    Release    `json:"release"`
	Repository Repository `json:"repository"`
}

ReleasePayload GitHub Release Webhook 的 payload 结构

func ParseReleasePayload

func ParseReleasePayload(data []byte) (*ReleasePayload, error)

ParseReleasePayload 解析 Release Webhook payload

func (*ReleasePayload) IsPublishedEvent

func (p *ReleasePayload) IsPublishedEvent() bool

IsPublishedEvent 判断是否是 published 事件

func (*ReleasePayload) IsTargetRepository

func (p *ReleasePayload) IsTargetRepository(fullName string) bool

IsTargetRepository 判断是否是目标仓库

type Repository

type Repository struct {
	FullName string `json:"full_name"`
	Name     string `json:"name"`
}

Repository GitHub 仓库信息

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL