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