Skip to content

Commit f83699f

Browse files
authored
Merge pull request #24 from github/print-version
Print the version of the sync tool whenever it runs.
2 parents 19e5eef + 6d06bd3 commit f83699f

File tree

4 files changed

+12
-0
lines changed

4 files changed

+12
-0
lines changed

cmd/pull.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,15 @@ package cmd
33
import (
44
"github.com/github/codeql-action-sync/internal/cachedirectory"
55
"github.com/github/codeql-action-sync/internal/pull"
6+
"github.com/github/codeql-action-sync/internal/version"
67
"github.com/spf13/cobra"
78
)
89

910
var pullCmd = &cobra.Command{
1011
Use: "pull",
1112
Short: "Pull the CodeQL Action from GitHub to a local cache.",
1213
RunE: func(cmd *cobra.Command, args []string) error {
14+
version.LogVersion()
1315
cacheDirectory := cachedirectory.NewCacheDirectory(rootFlags.cacheDir)
1416
return pull.Pull(cmd.Context(), cacheDirectory)
1517
},

cmd/push.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,15 @@ package cmd
33
import (
44
"github.com/github/codeql-action-sync/internal/cachedirectory"
55
"github.com/github/codeql-action-sync/internal/push"
6+
"github.com/github/codeql-action-sync/internal/version"
67
"github.com/spf13/cobra"
78
)
89

910
var pushCmd = &cobra.Command{
1011
Use: "push",
1112
Short: "Push the CodeQL Action from the local cache to a GitHub Enterprise Server installation.",
1213
RunE: func(cmd *cobra.Command, args []string) error {
14+
version.LogVersion()
1315
cacheDirectory := cachedirectory.NewCacheDirectory(rootFlags.cacheDir)
1416
return push.Push(cmd.Context(), cacheDirectory, pushFlags.destinationURL, pushFlags.destinationToken, pushFlags.destinationRepository)
1517
},

cmd/sync.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,15 @@ import (
44
"github.com/github/codeql-action-sync/internal/cachedirectory"
55
"github.com/github/codeql-action-sync/internal/pull"
66
"github.com/github/codeql-action-sync/internal/push"
7+
"github.com/github/codeql-action-sync/internal/version"
78
"github.com/spf13/cobra"
89
)
910

1011
var syncCmd = &cobra.Command{
1112
Use: "sync",
1213
Short: "Sync the CodeQL Action from GitHub to a GitHub Enterprise Server installation.",
1314
RunE: func(cmd *cobra.Command, args []string) error {
15+
version.LogVersion()
1416
cacheDirectory := cachedirectory.NewCacheDirectory(rootFlags.cacheDir)
1517
err := pull.Pull(cmd.Context(), cacheDirectory)
1618
if err != nil {

internal/version/version.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package version
22

3+
import "log"
4+
35
var version = "development"
46
var commit = "0000000000000000000000000000000000000000"
57

@@ -10,3 +12,7 @@ func Version() string {
1012
func Commit() string {
1113
return commit
1214
}
15+
16+
func LogVersion() {
17+
log.Printf("Starting CodeQL Action sync tool version %s...", Version())
18+
}

0 commit comments

Comments
 (0)