Skip to content

Commit 51d1f70

Browse files
committed
Add last-updated timestamp to the list of projects
1 parent ba50ca5 commit 51d1f70

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

cmd/generate-project-list/main.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,15 @@ import (
1010
"sort"
1111
"strings"
1212
"text/template"
13+
"time"
1314

1415
"github.com/google/go-github/v46/github"
1516
"github.com/jekyll/dashboard"
1617
)
1718

1819
var tmpl = template.Must(template.New(`configuration.go`).Parse(`//go:generate go run ./cmd/generate-project-list
1920
// THIS FILE IS AUTO-GENERATED WITH 'go generate .'
21+
// LAST UPDATED {{.Now.Format "Jan 02, 2006 15:04:05 UTC" }}
2022
package dashboard
2123
2224
var defaultProjects = []*Project{{"{"}}{{range .Repositories}}
@@ -32,6 +34,7 @@ var defaultProjects = []*Project{{"{"}}{{range .Repositories}}
3234

3335
type templateData struct {
3436
Repositories []*dashboard.Project
37+
Now time.Time
3538
}
3639

3740
var additionalProjectNames = map[string]bool{
@@ -96,7 +99,7 @@ func main() {
9699
})
97100

98101
s := &strings.Builder{}
99-
err = tmpl.Execute(s, templateData{Repositories: repoInfos})
102+
err = tmpl.Execute(s, templateData{Repositories: repoInfos, Now: time.Now().UTC()})
100103
if err != nil {
101104
log.Fatalf("unable to execute template: %v", err)
102105
}

configuration.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
//go:generate go run ./cmd/generate-project-list
22
// THIS FILE IS AUTO-GENERATED WITH 'go generate .'
3+
// LAST UPDATED Aug 22, 2022 01:17:04 UTC
34
package dashboard
45

56
var defaultProjects = []*Project{

0 commit comments

Comments
 (0)