hofstadter-io / cinful

Detect if your code is running in CI

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

cinful

Golang library and CLI to detect if a program is running in a CI system.

Pronounced "sinful" by mashing together CI, info, and the 'ful' suffix.

Originally ported from watson/ci-info and other links

as a CLI

prints details if in CI, otherwise nothing

cinful

cinful list # show all

Binaries are available on the releases page.

as a pkg

package main

import (
	"fmt"

	"github.com/hofstadter-io/cinful"
)

func main() {
	vendor := cinful.Info()
	if vendor != nil {
		fmt.Println(vendor)
	}
}

where

type Vendor struct {
	Name     string `json:"name,omitempty"`
	Constant string `json:"constant,omitempty"`
	Env      any    `json:"env,omitempty"`
	PR       any    `json:"pr,omitempty"`
	Val      string `json:"val,omitempty"`
}

Env will be a string after checking, but due to vendor differences, is a string, list, or map prior.

releasing

git must be clean first

release: goreleaser --rm-dist -p 1

snapshot (test): goreleaser --rm-dist -p 1 --snapshot

About

Detect if your code is running in CI

License:BSD 3-Clause "New" or "Revised" License


Languages

Language:Go 100.0%