-
-
Notifications
You must be signed in to change notification settings - Fork 198
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix gitlab gitkeep issue #3199
Fix gitlab gitkeep issue #3199
Conversation
🦋 Changeset detectedLatest commit: e7dcc35 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
try { | ||
await this.gitlabClient.Commits.create(this.projectId, this.branch, 'Deleting unnecessary .gitkeep files', gitkeepDeletions); | ||
} catch (e) { | ||
console.error('Failed to delete .gitkeep files:', e); |
Check warning
Code scanning / ESLint
disallow the use of `console`
{ action: 'delete', filePath: gitkeepPath }, | ||
]); | ||
} catch (e: any) { | ||
console.error(`Failed to delete .gitkeep: ${e}`); |
Check warning
Code scanning / ESLint
disallow the use of `console`
Commit SHA:2404d70164d44aa044c8807c9348e6cc33a942b8 Test coverage results 🧪
|
Commit SHA:2404d70164d44aa044c8807c9348e6cc33a942b8 |
Tested the fix and it works |
packages/tokens-studio-for-figma/src/storage/GitlabTokenStorage.ts
Outdated
Show resolved
Hide resolved
packages/tokens-studio-for-figma/src/storage/GitlabTokenStorage.ts
Outdated
Show resolved
Hide resolved
|
||
try { | ||
const response = await this.gitlabClient.Commits.create( | ||
await this.gitlabClient.Commits.create( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does this have a side-effect? we are kind of returning if it was a successful push, now we are depending on the gitkeep stuff. but if its a single file sync we should never even call the gitkeep action
packages/tokens-studio-for-figma/src/storage/GitlabTokenStorage.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
Comments suppressed due to low confidence (2)
packages/tokens-studio-for-figma/src/storage/GitlabTokenStorage.ts:114
- The new function 'cleanupGitkeepFiles' should be covered by tests to ensure its correctness.
private async cleanupGitkeepFiles(path: string, branch: string, message: string) {
packages/tokens-studio-for-figma/src/storage/GitlabTokenStorage.ts:289
- [nitpick] The error message logged here is generic. Consider logging a more specific error message for better debugging.
console.error(err);
Tip: If you use Visual Studio Code, you can request a review from Copilot before you push from the "Source Control" tab. Learn more
Why does this PR exist?
Fixes #3160
When gitlab creates empty folders/directories, it creates an empty .gitkeep files.
When our plugin users push tokens to those directories, they found that the gitkeep files still exist, thereby interfering with their token pipelines.
What does this pull request do?
This PR adds ability to remove gitkeep files in non empty directories, the next time user pushes a commit to Gitlab
Testing this change
Additional Notes (if any)