forked from warrensbox/terragunt-versions-list
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
46 lines (34 loc) · 982 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"time"
"github.com/warrensbox/terragrunt-versions-list/lib"
"github.com/warrensbox/terragrunt-versions-list/modal"
)
const (
terragruntURL = "https://api.github.com/repos/gruntwork-io/terragrunt/releases?"
)
var version = "0.2.0\n"
var CLIENT_ID = "xxx"
var CLIENT_SECRET = "xxx"
func main() {
var client modal.Client
client.ClientID = CLIENT_ID
client.ClientSecret = CLIENT_SECRET
allVersions, _ := lib.GetAppList(terragruntURL, &client)
var list List
list.Versions = allVersions
currentTime := time.Now()
fmt.Println("YYYY.MM.DD : ", currentTime.Format("2006.01.02 15:04:05"))
lastUpdate := currentTime.Format("2006.01.02 15:04:05")
lastUpdateUTC := fmt.Sprintf("%s UTC", lastUpdate)
list.LastUpdated = lastUpdateUTC
file, _ := json.MarshalIndent(list, "", " ")
_ = ioutil.WriteFile("index.json", file, 0644)
}
type List struct {
LastUpdated string
Versions []string `json:"Versions"`
}