Commit 07f6f9d
authored
feat: implement
This Pull request implements the branch creation script whose primary
function is to create a new branch from the forked repository for an
authenticated user.
### Changes Made
- Implemented the main `createBranch` function in the `branch` script at
`src/lib/branch.js`; this function takes in 3 params;
- `userOctokit` - a user authenticated instance of octokit that can be
used to perform action on user's behalf
- `repoDetails` - the user's forked repo details; hold the
`repoFullname` and `repoMainBranchRef` as properties in the object type
param
- `newBranchName` - name of the branch that will be created for the user
The `createBranch` function performs the following operation in the
stated order...
- It initially fetches the forked repository main branch where we wished
to create the new branch off of; it does this using the `getBranch`
helper function; this return the `SHA` of the branch
- Then we make a request to the endpoint `"POST
/repos/{owner}/{repo}/git/refs"` to create the new branch; passing in
the `repoDetails.repoFullname` properties, the head branch `SHA` and the
`newBranchName`.
- Moved the `getBranch` function from the `fork` script to the `branch`
script
### Screencast/Screenshot
[screencast-bpconcjcammlapcogcnnelfmaeghhagj-2024.04.01-13_54_14.webm](https://github.com/babblebey/jargons.dev/assets/25631971/62a2f9b1-7643-42e3-b91f-1427fad1c170)branch creation script (#17)1 parent 700fd08 commit 07f6f9d
2 files changed
Lines changed: 51 additions & 19 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
1 | 2 | | |
2 | 3 | | |
3 | 4 | | |
| |||
90 | 91 | | |
91 | 92 | | |
92 | 93 | | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | 94 | | |
113 | 95 | | |
114 | 96 | | |
| |||
0 commit comments