func Branch() string {
	return strings.Split(Ref, "/")[2]
}
Branch returns the push branch for push flow or empty string for other flows.
package goaction
import (
	"fmt"
	"log"
	"os"
	"strconv"
	"strings"
)
var (
	CI = os.Getenv("CI") == "true"
	Home = os.Getenv("HOME")
	Workflow = os.Getenv("GITHUB_WORKFLOW")
	RunID = os.Getenv("GITHUB_RUN_ID")
	RunNum = os.Getenv("GITHUB_RUN_NUMBER")
	ActionID = os.Getenv("GITHUB_ACTION")
	Actor = os.Getenv("GITHUB_ACTOR")
	Repository = os.Getenv("GITHUB_REPOSITORY")
	Event = EventType(os.Getenv("GITHUB_EVENT_NAME"))
	Workspace = os.Getenv("GITHUB_WORKSPACE")
	SHA = os.Getenv("GITHUB_SHA")
	Ref = os.Getenv("GITHUB_REF")
	ForkedHeadRef = os.Getenv("GITHUB_HEAD_REF")
	ForkedBaseRef = os.Getenv("GITHUB_BASE_REF")
	eventPath = os.Getenv("GITHUB_EVENT_PATH")
	envPath   = os.Getenv("GITHUB_ENV")
	repoParts = strings.Split(Repository, "/")
)
func init() {
	if CI {
		log.SetOutput(os.Stdout)
	}
}
func Setenv(name string, value string) error {
	if !CI {
		return nil
	}
	f, err := os.OpenFile(envPath, os.O_APPEND|os.O_CREATE|os.O_RDWR, 0)
	if err != nil {
		return fmt.Errorf("can't open env file %s: %s", envPath, err)
	}
	defer f.Close()
	_, err = fmt.Fprintf(f, "%s=%s\n", name, value)
	if err != nil {
		return fmt.Errorf("failed writing to env file: %s", err)
	}
	return nil
}
func Export(name string, value string) error {
	err := os.Setenv(name, value)
	if err != nil {
		return err
	}
	return Setenv(name, value)
}
func Output(name string, value string, desc string) {
	if !CI {
		return
	}
	fmt.Printf("::set-output name=%s::%s\n", name, value)
}
func AddPath(path string) {
	if !CI {
		return
	}
	fmt.Printf("::add-path::%s\n", path)
}
func Owner() string {
	if len(repoParts) < 2 {
		return ""
	}
	return repoParts[0]
}
func Project() string {
	if len(repoParts) < 2 {
		return ""
	}
	return repoParts[1]
}