Skip to content
Snippets Groups Projects
Select Git revision
  • 81d40dfcb01186de1e7cb297556da642048c1136
  • master default protected
  • dependabot/npm_and_yarn/webui/npm_and_yarn-7d065cd83c
  • dependabot/go_modules/go_modules-985326579b
  • gh-pages
  • trunk
  • graphql-subscription
  • feat/1467/git-repo-path
  • board
  • I738207f8cb254b66f3ef18aa525fce39c71060e2
  • Ia1ad61e54e305bb073efc6853738d3eed81d576c
  • feat/lipgloss-formatting
  • bootstrap-rework-2
  • boostrap-rework
  • github-config-resilience
  • feat-849-terminal-output-in-core
  • gitea-bridge
  • feat-licences-checks
  • complete-comment
  • graphql-generics
  • fix/810-finish-reading-loop
  • v0.10.1
  • v0.10.0
  • v0.9.0
  • v0.8.1
  • v0.8.0
  • v0.7.2
  • 0.7.1
  • 0.7.0
  • 0.6.0
  • 0.5.0
  • 0.4.0
  • 0.3.0
  • 0.2.0
  • 0.1.0
35 results

git-bug-bridge-configure.1

Blame
  • gitlab.go 915 B
    package condition
    
    import (
    	"fmt"
    	"os"
    )
    
    var CIVERSION = "dev"
    
    type GitLab struct {
    }
    
    func (gl *GitLab) Name() string {
    	return "GitLab CI"
    }
    
    func (gl *GitLab) Version() string {
    	return CIVERSION
    }
    
    func (gl *GitLab) GetCurrentBranch() string {
    	return os.Getenv("CI_COMMIT_BRANCH")
    }
    
    func (gl *GitLab) GetCurrentSHA() string {
    	return os.Getenv("CI_COMMIT_SHA")
    }
    
    func (gl *GitLab) IsBranchRef() bool {
    	return gl.GetCurrentBranch() != ""
    }
    
    func (gl *GitLab) RunCondition(config map[string]string) error {
    	defaultBranch := config["defaultBranch"]
    	if !gl.IsBranchRef() {
    		return fmt.Errorf("This test run is not running on a branch build.")
    	}
    	if branch := gl.GetCurrentBranch(); defaultBranch != "*" && branch != defaultBranch {
    		return fmt.Errorf("This test run was triggered on the branch %s, while semantic-release is configured to only publish from %s.", branch, defaultBranch)
    	}
    	return nil
    }