Add possiblity to limit actions to tagged or named repository

This commit is contained in:
Mikołaj Pęczkowski 2021-11-07 14:05:45 +01:00
parent 5c98ab6554
commit 23e4547e52
11 changed files with 345 additions and 24 deletions

View file

@ -5,6 +5,8 @@ import (
"fmt"
"io/ioutil"
"strings"
"gitlab.com/revalus/grm/config"
)
func getFileContent(pathToFile string) ([]byte, error) {
@ -23,3 +25,31 @@ func getFileExcension(pathToFile string) (string, error) {
return fileExcension, nil
}
func checkIsItemInSlice(check string, sliceToCheck []string) bool {
for _, item := range sliceToCheck {
if item == check {
return true
}
}
return false
}
func checkAnyOfItemInSlice(check []string, sliceToCheck []string) bool {
for _, item := range check {
if checkIsItemInSlice(item, sliceToCheck) {
return true
}
}
return false
}
func reverseRepositoryConfigs(repositories []config.RepositoryConfig) []config.RepositoryConfig {
for i, j := 0, len(repositories)-1; i < j; i, j = i+1, j-1 {
repositories[i], repositories[j] = repositories[j], repositories[i]
}
return repositories
}