Skip to content
This repository was archived by the owner on Aug 21, 2025. It is now read-only.

Commit 7a128d2

Browse files
authored
imrpove workflow logging and logic (#33)
1 parent 7883bfa commit 7a128d2

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/commands/link/index.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ export default class LinkIndex extends Command {
164164
const projectName = await promptProjectName(projects)
165165
const newProject = await sendCreateProjectReq(settings.jwt, settings.orgId, projectName, repoId, repoName)
166166

167-
this.log(chalk.green('Successfully created project ' + newProject.name + ' and linked it to repo ' + repoName + '! 🎉'))
167+
this.log(chalk.blueBright('Successfully created project ' + newProject.name + ' and linked it to repo ' + repoName + '! Setting up CI workflow...'))
168168
}
169169

170170
// add ci workflow to the repo if it doesn't already exist
@@ -176,16 +176,22 @@ export default class LinkIndex extends Command {
176176
fs.mkdirSync(githubWorkflowDir, {recursive: true})
177177
}
178178

179+
let shouldCreateCIFile = true
179180
if (fileExists(ciHypFilePath)) {
180181
// prompt if they want to replace it
181182
const confirmOverwrite = await confirmOverwriteCiHypFile()
182183
if (!confirmOverwrite) {
183184
this.log(chalk.yellow('Skipping ci-hyp.yml creation.'))
185+
shouldCreateCIFile = false
184186
}
185187
}
186188

187-
// create the file
188-
fs.writeFileSync(ciHypFilePath, ciStr, {flag: 'w'})
189+
if (shouldCreateCIFile) {
190+
fs.writeFileSync(ciHypFilePath, ciStr)
191+
this.log(chalk.green('Successfully created ci-hyp.yml! 🎉'))
192+
}
193+
194+
this.log(chalk.green('Linking complete! 🎉'))
189195
}
190196
}
191197

0 commit comments

Comments
 (0)