Api: publish api
This commit is contained in:
parent
2b18269af9
commit
596e96947a
1 changed files with 4 additions and 5 deletions
9
main.go
9
main.go
|
@ -188,7 +188,7 @@ func notify(jsonResponse string) {
|
|||
defer resp.Body.Close()
|
||||
}
|
||||
|
||||
func TriggerPublish() {
|
||||
func TriggerPublish(c *gin.Context) {
|
||||
godotenv.Load(".botenv")
|
||||
FORGEJO := os.Getenv("FORGEJO_TOKEN")
|
||||
payload := `{"ref": "main"}`
|
||||
|
@ -201,6 +201,8 @@ func TriggerPublish() {
|
|||
|
||||
client := &http.Client{}
|
||||
client.Do(req)
|
||||
c.Redirect(http.StatusFound, "https://git.askar.tv/nomad/alaskartv-app/actions")
|
||||
|
||||
}
|
||||
|
||||
func main() {
|
||||
|
@ -254,10 +256,7 @@ func main() {
|
|||
|
||||
})
|
||||
|
||||
router.POST("/api/publish", func(c *gin.Context) {
|
||||
TriggerPublish()
|
||||
c.JSON(http.StatusOK, gin.H{"message": "Workflow triggered successfully"})
|
||||
})
|
||||
router.GET("/api/publish", TriggerPublish)
|
||||
|
||||
router.POST("/notify", notifyHandler)
|
||||
router.GET("/", func(c *gin.Context) {
|
||||
|
|
Loading…
Reference in a new issue