Skip to content

Commit 73aac2f

Browse files
Ani1357j-zimnowoda
andauthored
fix: Apl 307 apl-charts repo creation (#1774)
Co-authored-by: jeho <[email protected]>
1 parent af37325 commit 73aac2f

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/cmd/commit.ts

+8-1
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,20 @@ export const commit = async (): Promise<void> => {
7575

7676
export const cloneOtomiChartsInGitea = async (): Promise<void> => {
7777
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')
7979
const values = (await hfValues()) as Record<string, any>
8080
const { email, username, password } = getRepo(values)
8181
const workDir = '/tmp/apl-charts'
8282
const otomiChartsUrl = env.OTOMI_CHARTS_URL
8383
const giteaChartsUrl = `http://${username}:${password}@gitea-http.gitea.svc.cluster.local:3000/otomi/charts.git`
8484
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')
8592
await $`mkdir ${workDir}`
8693
await $`git clone --depth 1 ${otomiChartsUrl} ${workDir}`
8794
cd(workDir)

0 commit comments

Comments
 (0)