Commit ee5d72b
authored
feat: add GitHub Direct Commit support (#333)
* feat: add GitHub Direct Commit support
- Add github_commit authentication type for direct file commits
- Implement GithubRepository module for GitHub API integration
- Add UI components for branch, filepath, and commit message configuration
- Update README documentation with github_commit auth option
- Supports automatic branch creation if not exists
- Handles both file creation and updates via GitHub API
* refactor: use URL object for more robust GitHub URL parsing
* docs: add GitHub Direct Commit URL examples to README
* refactor: remove simple owner/repo URL format support
- Remove simple owner/repo format from URL parsing logic
- Update README to document only supported URL formats
- Keep support for https://api.github.com/repos/owner/repo
- Keep support for https://github.com/owner/repo
- Remove :username/:repo format that fails HTML5 validation
* fix: update placeholder to show only supported GitHub URL formats
* docs: simplify GitHub Direct Commit URL format documentation
* fix: address code review feedback
- Add proper URI encoding for filenames with special characters
- Improve 422 status handling to only accept 'Reference already exists'
- Remove redundant targetBranch variable for code clarity
* test: add comprehensive tests for githubRepository module
- Test constructor initialization
- Test upload to existing branch with new/existing files
- Test branch creation when branch doesn't exist
- Test default commit message generation
- Test URL encoding for special characters and unicode
- Mock XMLHttpRequest for isolated unit testing
- Coverage increased from 1.76% to 46.01%
Addresses code review comment about test coverage decrease
* test: improve githubRepository test coverage to 50.44%
- Add tests for URL encoding with slashes
- Add tests for 422 Reference already exists handling
- Add tests for other 422 validation errors
- Add tests for invalid JSON in 422 responses
- Add tests for 401 and 403 error handling
- Coverage improved from 46.01% to 50.44%
This addresses the code review comment about test coverage decrease
* test: add comprehensive tests for githubRepository and urlExport
- Add 18 tests for githubRepository module covering upload, error handling, and URL encoding
- Add 6 tests for urlExport githubCommit auth type integration
- Improve githubRepository branch coverage from 22% to 40.74%
- Test URI encoding fix (encodeURIComponent)
- Test 422 error handling with 'Reference already exists' message
- Test URL parsing for both API and web URL formats
* style: remove extra blank line in githubRepository.ts
* style: remove trailing whitespace in test files
* build: rebuild dist files with latest changes1 parent 8ea92fb commit ee5d72b
File tree
10 files changed
+1020
-51
lines changed- dist
- src
- config
- ui
- components
- modules
- tests/unit
10 files changed
+1020
-51
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
6 | | - | |
7 | | - | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
40 | | - | |
| 40 | + | |
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| |||
353 | 353 | | |
354 | 354 | | |
355 | 355 | | |
356 | | - | |
| 356 | + | |
357 | 357 | | |
358 | 358 | | |
359 | 359 | | |
| |||
449 | 449 | | |
450 | 450 | | |
451 | 451 | | |
452 | | - | |
| 452 | + | |
453 | 453 | | |
454 | 454 | | |
455 | 455 | | |
| |||
480 | 480 | | |
481 | 481 | | |
482 | 482 | | |
483 | | - | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
484 | 486 | | |
485 | 487 | | |
486 | 488 | | |
| |||
492 | 494 | | |
493 | 495 | | |
494 | 496 | | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
495 | 504 | | |
496 | 505 | | |
497 | 506 | | |
498 | 507 | | |
499 | | - | |
| 508 | + | |
| 509 | + | |
500 | 510 | | |
501 | 511 | | |
502 | 512 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Large diffs are not rendered by default.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
151 | 151 | | |
152 | 152 | | |
153 | 153 | | |
| 154 | + | |
| 155 | + | |
154 | 156 | | |
155 | 157 | | |
156 | 158 | | |
| |||
209 | 211 | | |
210 | 212 | | |
211 | 213 | | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
212 | 218 | | |
213 | 219 | | |
214 | 220 | | |
| |||
270 | 276 | | |
271 | 277 | | |
272 | 278 | | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
273 | 305 | | |
274 | 306 | | |
275 | 307 | | |
| |||
0 commit comments