Jaypore CI

> Jaypore CI: Minimal, Offline, Local CI system.
Log | Files | Refs | README

push.go (531B)


      1 package jci
      2 
      3 import (
      4 	"fmt"
      5 )
      6 
      7 // Push pushes CI results to remote
      8 func Push(args []string) error {
      9 	remote := "origin"
     10 	if len(args) > 0 {
     11 		remote = args[0]
     12 	}
     13 
     14 	refs, err := ListJCIRefs()
     15 	if err != nil {
     16 		return err
     17 	}
     18 
     19 	if len(refs) == 0 {
     20 		fmt.Println("No CI results to push")
     21 		return nil
     22 	}
     23 
     24 	fmt.Printf("Pushing %d CI result(s) to %s...\n", len(refs), remote)
     25 
     26 	// Push all refs/jci/* to remote
     27 	_, err = git("push", remote, "refs/jci/*:refs/jci/*")
     28 	if err != nil {
     29 		return err
     30 	}
     31 
     32 	fmt.Println("Done")
     33 	return nil
     34 }