-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathmain.go
More file actions
30 lines (27 loc) · 675 Bytes
/
main.go
File metadata and controls
30 lines (27 loc) · 675 Bytes
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
package main
import (
"encoding/json"
"github-telegram-notify/types"
"github-telegram-notify/utils"
"os"
)
func main() {
tg_token := os.Getenv("INPUT_BOT_TOKEN")
chatID := os.Getenv("INPUT_CHAT_ID")
topicID := os.Getenv("INPUT_TOPIC_ID")
gitEventRaw := os.Getenv("INPUT_GIT_EVENT")
print(gitEventRaw)
var gitEvent *types.Metadata
err := json.Unmarshal([]byte(gitEventRaw), &gitEvent)
if err != nil {
panic(err)
}
text, markupText, markupUrl, err := utils.CreateContents(gitEvent)
if err != nil {
panic(err)
}
error := utils.SendMessage(tg_token, chatID, text, markupText, markupUrl, topicID)
if error.Description != "" {
panic(error.String())
}
}