mirror of
https://github.com/harness/drone.git
synced 2025-05-11 22:50:11 +08:00
25 lines
563 B
Go
25 lines
563 B
Go
// Copyright 2022 Harness Inc. All rights reserved.
|
|
// Use of this source code is governed by the Polyform Free Trial License
|
|
// that can be found in the LICENSE.md file for this repository.
|
|
|
|
package importer
|
|
|
|
import (
|
|
"strconv"
|
|
"strings"
|
|
)
|
|
|
|
const jobIDPrefix = "import-repo-"
|
|
|
|
func JobIDFromRepoID(repoID int64) string {
|
|
return jobIDPrefix + strconv.FormatInt(repoID, 10)
|
|
}
|
|
|
|
func RepoIDFromJobID(jobID string) int64 {
|
|
if !strings.HasPrefix(jobID, jobIDPrefix) {
|
|
return 0
|
|
}
|
|
repoID, _ := strconv.ParseInt(jobID[len(jobIDPrefix):], 10, 64)
|
|
return repoID
|
|
}
|