Documentation
¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Concurrency ¶ added in v0.5.0
type Concurrency struct {
CancelInProgress string `yaml:"cancel-in-progress,omitempty"`
Group string `yaml:"group,omitempty"`
}
Concurrency is a model of a GitHub Actions `concurrency:` object.
func (*Concurrency) UnmarshalYAML ¶ added in v0.5.2
func (c *Concurrency) UnmarshalYAML(n *yaml.Node) error
type Defaults ¶ added in v0.5.0
type Defaults struct {
Run DefaultsRun `yaml:"run,omitempty"`
}
Defaults is a model of a GitHub Actions `defaults:` object.
type DefaultsRun ¶ added in v0.5.0
type DefaultsRun struct {
Shell string `yaml:"shell,omitempty"`
WorkingDirectory string `yaml:"working-directory,omitempty"`
}
DefaultsRun is a model of a GitHub Actions `defaults.run:` object.
type Environment ¶ added in v0.5.0
Environment is a model of a GitHub Actions `environment:` object.
func (*Environment) UnmarshalYAML ¶ added in v0.5.0
func (e *Environment) UnmarshalYAML(n *yaml.Node) error
type Input ¶ added in v0.4.0
type Input struct {
Description string `yaml:"description"`
Default string `yaml:"default,omitempty"`
Required bool `yaml:"required,omitempty"`
DeprecationMessage string `yaml:"deprecationMessage,omitempty"`
}
Input is a model of an Action Manifest's `inputs:`.
type Job ¶
type Job struct {
Name string `yaml:"name,omitempty"`
Environment Environment `yaml:"environment,omitempty"`
ContinueOnError bool `yaml:"continue-on-error,omitempty"`
TimeoutMinutes int `yaml:"timeout-minutes,omitempty"`
If string `yaml:"if,omitempty"`
Needs Needs `yaml:"needs,omitempty"`
Concurrency Concurrency `yaml:"concurrency,omitempty"`
Defaults Defaults `yaml:"defaults,omitempty"`
Strategy Strategy `yaml:"strategy,omitempty"`
Services map[string]Service `yaml:"services,omitempty"`
Outputs map[string]string `yaml:"outputs,omitempty"`
Permissions Permissions `yaml:"permissions,omitempty"`
Env map[string]string `yaml:"env,omitempty"`
Steps []Step `yaml:"steps,omitempty"`
Uses string `yaml:"uses,omitempty"`
With map[string]string `yaml:"with,omitempty"`
}
Job is a model of a GitHub Actions workflow job.
type Manifest ¶
type Manifest struct {
Name string `yaml:"name"`
Author string `yaml:"author,omitempty"`
Description string `yaml:"description"`
Branding Branding `yaml:"branding,omitempty"`
Inputs map[string]Input `yaml:"inputs,omitempty"`
Outputs map[string]Output `yaml:"outputs,omitempty"`
Runs Runs `yaml:"runs"`
}
Manifest is a model of a GitHub Actions Action manifest.
func ParseManifest ¶
ParseManifest parses a GitHub Actions Action manifest into a Manifest.
Example ¶
yaml := `
name: Hello World
description: Greet someone and record the time
inputs:
who-to-greet: # id of input
description: Who to greet
required: true
default: World
outputs:
time: # id of output
description: The time we greeted you
runs:
using: node20
main: index.js`
manifest, _ := ParseManifest([]byte(yaml))
fmt.Println(manifest.Name)
Output: Hello World
type Permissions ¶ added in v0.5.0
type Permissions struct {
Actions string `yaml:"actions,omitempty"`
Attestations string `yaml:"attestations,omitempty"`
Checks string `yaml:"checks,omitempty"`
Contents string `yaml:"contents,omitempty"`
Deployments string `yaml:"deployments,omitempty"`
Discussions string `yaml:"discussions,omitempty"`
IdToken string `yaml:"id-token,omitempty"`
Issues string `yaml:"issues,omitempty"`
Models string `yaml:"models,omitempty"`
Packages string `yaml:"packages,omitempty"`
Pages string `yaml:"pages,omitempty"`
PullRequests string `yaml:"pull-requests,omitempty"`
SecurityEvents string `yaml:"security-events,omitempty"`
Statuses string `yaml:"statuses,omitempty"`
}
Permissions is a model of a GitHub Actions `permissions:` object.
func (*Permissions) UnmarshalYAML ¶ added in v0.5.0
func (p *Permissions) UnmarshalYAML(n *yaml.Node) error
type Runs ¶ added in v0.3.0
type Runs struct {
Using string `yaml:"using"`
Steps []Step `yaml:"steps,omitempty"`
Image string `yaml:"image,omitempty"`
PreEntrypoint string `yaml:"pre-entrypoint,omitempty"`
Entrypoint string `yaml:"entrypoint,omitempty"`
PostEntrypoint string `yaml:"post-entrypoint,omitempty"`
Args []string `yaml:"args,omitempty"`
Env map[string]string `yaml:"env,omitempty"`
Pre string `yaml:"pre,omitempty"`
PreIf string `yaml:"pre-if,omitempty"`
Main string `yaml:"main,omitempty"`
Post string `yaml:"post,omitempty"`
PostIf string `yaml:"post-if,omitempty"`
}
Runs is a model of an Action Manifest's `runs:` object.
type Service ¶ added in v0.5.0
type Service struct {
Image string `yaml:"image"`
Credentials ServiceCredentials `yaml:"credentials,omitempty"`
Env map[string]string `yaml:"env,omitempty"`
Ports Ports `yaml:"ports,omitempty"`
Volumes []string `yaml:"volumes,omitempty"`
Options string `yaml:"options,omitempty"`
}
Service is a model of a GitHub Actions `services:` object.
type ServiceCredentials ¶ added in v0.5.0
type ServiceCredentials struct {
Username string `yaml:"username"`
Password string `yaml:"password"`
}
ServiceCredentials is a model of a GitHub Actions `services.credentials:` object.
type Step ¶
type Step struct {
Name string `yaml:"name,omitempty"`
Uses Uses `yaml:"uses,omitempty"`
Id string `yaml:"id,omitempty"`
If string `yaml:"if,omitempty"`
ContinueOnError bool `yaml:"continue-on-error,omitempty"`
TimeoutMinutes uint `yaml:"timeout-minutes,omitempty"`
WorkingDirectory string `yaml:"working-directory,omitempty"`
Shell string `yaml:"shell,omitempty"`
Run string `yaml:"run,omitempty"`
With map[string]string `yaml:"with,omitempty"`
Env map[string]string `yaml:"env,omitempty"`
}
Step is a model of a workflow/manifest job step.
type Strategy ¶ added in v0.5.1
type Strategy struct {
Matrix Matrix `yaml:"matrix,omitempty"`
FailFast bool `yaml:"fail-fast,omitempty"`
MaxParallel int `yaml:"max-parallel,omitempty"`
}
Strategy is a model of a GitHub Actions `strategy:` object.
type Uses ¶
type Uses struct {
// Name is the name of the Action that is used. Typically <owner>/<repository>.
Name string
// Ref is the git reference used for the Action. Typically a tag ref, branch ref, or commit SHA.
Ref string
// Annotation is the comment after the `uses:` value, if any.
Annotation string
}
Uses is a model of a step `uses:` value.
type Workflow ¶
type Workflow struct {
Name string `yaml:"name,omitempty"`
RunName string `yaml:"run-name,omitempty"`
Permissions Permissions `yaml:"permissions,omitempty"`
Concurrency Concurrency `yaml:"concurrency,omitempty"`
Defaults Defaults `yaml:"defaults,omitempty"`
Env map[string]string `yaml:"env,omitempty"`
Jobs map[string]Job `yaml:"jobs"`
}
Workflow is a model of a GitHub Actions workflow.
func ParseWorkflow ¶
ParseWorkflow parses a GitHub Actions workflow into a Workflow.
Example ¶
yaml := `
name: learn-github-actions
run-name: ${{ github.actor }} is learning GitHub Actions
on: [push]
jobs:
check-bats-version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
- run: npm install -g bats
- run: bats -v`
workflow, _ := ParseWorkflow([]byte(yaml))
fmt.Println(workflow.Name)
Output: learn-github-actions