added show-progress flag
This commit is contained in:
parent
8051c9f945
commit
7e556b4206
@ -38,6 +38,10 @@ inputs:
|
|||||||
description: 'power download tag or not'
|
description: 'power download tag or not'
|
||||||
required: false
|
required: false
|
||||||
default: false
|
default: false
|
||||||
|
progress:
|
||||||
|
description: 'off/on detail progress git command in clone and fetch'
|
||||||
|
required: false
|
||||||
|
default: false
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: 'go'
|
using: 'go'
|
||||||
|
@ -19,9 +19,10 @@ type Config struct {
|
|||||||
Clean bool
|
Clean bool
|
||||||
LFS bool
|
LFS bool
|
||||||
FetchTags bool
|
FetchTags bool
|
||||||
|
Progress bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// todo filter, sparse-checkout, sparse-checkout-cone-mode, fetch-tags, show-progress, submodules, set-safe-directory
|
// todo filter, sparse-checkout, sparse-checkout-cone-mode, fetch-tags, submodules, set-safe-directory
|
||||||
|
|
||||||
type CheckoutType string
|
type CheckoutType string
|
||||||
|
|
||||||
@ -55,6 +56,12 @@ func getConfig() Config {
|
|||||||
fetchTagsBool = true
|
fetchTagsBool = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
progress := os.Getenv("INPUT_PROGRESS")
|
||||||
|
progressBool := false
|
||||||
|
if progress == "1" || progress == "true" || progress == "t" {
|
||||||
|
progressBool = true
|
||||||
|
}
|
||||||
|
|
||||||
return Config{
|
return Config{
|
||||||
Repository: os.Getenv("INPUT_REPOSITORY"),
|
Repository: os.Getenv("INPUT_REPOSITORY"),
|
||||||
Ref: os.Getenv("INPUT_REF"),
|
Ref: os.Getenv("INPUT_REF"),
|
||||||
@ -66,6 +73,7 @@ func getConfig() Config {
|
|||||||
Clean: cleanBool,
|
Clean: cleanBool,
|
||||||
LFS: lfsBool,
|
LFS: lfsBool,
|
||||||
FetchTags: fetchTagsBool,
|
FetchTags: fetchTagsBool,
|
||||||
|
Progress: progressBool,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -102,6 +110,9 @@ func main() {
|
|||||||
if cfg.FetchTags {
|
if cfg.FetchTags {
|
||||||
cloneArgs = append(cloneArgs, "--tags")
|
cloneArgs = append(cloneArgs, "--tags")
|
||||||
}
|
}
|
||||||
|
if cfg.Progress {
|
||||||
|
cloneArgs = append(cloneArgs, "--progress")
|
||||||
|
}
|
||||||
cloneArgs = append(cloneArgs, fmt.Sprintf("--depth=%s", cfg.FetchDepth), cloneURL, cfg.Path)
|
cloneArgs = append(cloneArgs, fmt.Sprintf("--depth=%s", cfg.FetchDepth), cloneURL, cfg.Path)
|
||||||
run("git", cloneArgs...)
|
run("git", cloneArgs...)
|
||||||
|
|
||||||
@ -112,6 +123,9 @@ func main() {
|
|||||||
if cfg.FetchTags {
|
if cfg.FetchTags {
|
||||||
fetchArgs = append(fetchArgs, "--tags")
|
fetchArgs = append(fetchArgs, "--tags")
|
||||||
}
|
}
|
||||||
|
if cfg.Progress {
|
||||||
|
fetchArgs = append(fetchArgs, "--progress")
|
||||||
|
}
|
||||||
fetchArgs = append(fetchArgs, fmt.Sprintf("--depth=%s", cfg.FetchDepth), "origin", cfg.Ref)
|
fetchArgs = append(fetchArgs, fmt.Sprintf("--depth=%s", cfg.FetchDepth), "origin", cfg.Ref)
|
||||||
run("git", fetchArgs...)
|
run("git", fetchArgs...)
|
||||||
run("git", "-C", cfg.Path, "checkout", "FETCH_HEAD")
|
run("git", "-C", cfg.Path, "checkout", "FETCH_HEAD")
|
||||||
|
Loading…
Reference in New Issue
Block a user