mirror of
https://code.forgejo.org/forgejo/runner.git
synced 2025-08-11 17:50:58 +00:00
Support setting shell via defaults.run (#343)
Note that we don't support the more general use of defaults, just its run key for setting shell and working directory. The documentation for defaults.run is here: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#defaultsrun Fixes #214. Co-authored-by: Casey Lee <cplee@nektos.com>
This commit is contained in:
parent
7f17e0a9f4
commit
95240475c3
4 changed files with 60 additions and 4 deletions
|
@ -13,10 +13,11 @@ import (
|
|||
|
||||
// Workflow is the structure of the files in .github/workflows
|
||||
type Workflow struct {
|
||||
Name string `yaml:"name"`
|
||||
RawOn yaml.Node `yaml:"on"`
|
||||
Env map[string]string `yaml:"env"`
|
||||
Jobs map[string]*Job `yaml:"jobs"`
|
||||
Name string `yaml:"name"`
|
||||
RawOn yaml.Node `yaml:"on"`
|
||||
Env map[string]string `yaml:"env"`
|
||||
Jobs map[string]*Job `yaml:"jobs"`
|
||||
Defaults Defaults `yaml:"defaults"`
|
||||
}
|
||||
|
||||
// On events for the workflow
|
||||
|
@ -64,6 +65,7 @@ type Job struct {
|
|||
Services map[string]*ContainerSpec `yaml:"services"`
|
||||
Strategy *Strategy `yaml:"strategy"`
|
||||
RawContainer yaml.Node `yaml:"container"`
|
||||
Defaults Defaults `yaml:"defaults"`
|
||||
}
|
||||
|
||||
// Strategy for the job
|
||||
|
@ -73,6 +75,17 @@ type Strategy struct {
|
|||
Matrix map[string][]interface{} `yaml:"matrix"`
|
||||
}
|
||||
|
||||
// Default settings that will apply to all steps in the job or workflow
|
||||
type Defaults struct {
|
||||
Run RunDefaults `yaml:"run"`
|
||||
}
|
||||
|
||||
// Defaults for all run steps in the job or workflow
|
||||
type RunDefaults struct {
|
||||
Shell string `yaml:"shell"`
|
||||
WorkingDirectory string `yaml:"working-directory"`
|
||||
}
|
||||
|
||||
// Container details for the job
|
||||
func (j *Job) Container() *ContainerSpec {
|
||||
var val *ContainerSpec
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue