File tree 1 file changed +8
-1
lines changed
1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -75,13 +75,20 @@ export const commit = async (): Promise<void> => {
75
75
76
76
export const cloneOtomiChartsInGitea = async ( ) : Promise < void > => {
77
77
const d = terminal ( `cmd:${ cmdName } :gitea-apl-charts` )
78
- d . info ( 'Cloning apl-charts in Gitea' )
78
+ d . info ( 'Checking if apl-charts already exists in Gitea' )
79
79
const values = ( await hfValues ( ) ) as Record < string , any >
80
80
const { email, username, password } = getRepo ( values )
81
81
const workDir = '/tmp/apl-charts'
82
82
const otomiChartsUrl = env . OTOMI_CHARTS_URL
83
83
const giteaChartsUrl = `http://${ username } :${ password } @gitea-http.gitea.svc.cluster.local:3000/otomi/charts.git`
84
84
try {
85
+ // Check if remote repository exists by verifying if output from git ls-remote is not empty
86
+ const repoExists = await $ `git ls-remote ${ giteaChartsUrl } `
87
+ if ( repoExists . stdout . trim ( ) ) {
88
+ d . info ( 'apl-charts repository already exists in Gitea. Skipping clone and initialization steps.' )
89
+ return
90
+ }
91
+ d . info ( 'Cloning apl-charts in Gitea' )
85
92
await $ `mkdir ${ workDir } `
86
93
await $ `git clone --depth 1 ${ otomiChartsUrl } ${ workDir } `
87
94
cd ( workDir )
You can’t perform that action at this time.
0 commit comments