Skip to content

Commit 64cbb85

Browse files
jalveszjvdp1
andauthored
feat: Add github collaboration script and workflow documentation (#987)
* add collab script and documentation in the workflow * typo * clarify github workflow collab proposal * Update WORKFLOW.md Co-authored-by: Jeremie Vandenplas <jeremie.vandenplas@gmail.com> --------- Co-authored-by: Jeremie Vandenplas <jeremie.vandenplas@gmail.com>
1 parent 875d94d commit 64cbb85

File tree

2 files changed

+70
-0
lines changed

2 files changed

+70
-0
lines changed

.github/collab.sh

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/bin/bash
2+
3+
echo "📦 GitHub Fork Collaboration Setup Script"
4+
5+
# Prompt for User's GitHub username
6+
7+
read -p "Enter the GitHub username of the fork owner (e.g., alice): " USER
8+
9+
# Prompt for the branch name
10+
11+
read -p "Enter the PR branch name (e.g., feature-branch): " BRANCH
12+
13+
# Add remotes
14+
15+
echo "🔗 Adding remotes..."
16+
17+
git remote add $USER https://github.com/$USER/stdlib.git
18+
19+
# Fetch and checkout the PR branch
20+
21+
echo "📥 Fetching branch '$BRANCH'..."
22+
23+
git fetch $USER
24+
25+
git checkout -b $BRANCH $USER/$BRANCH
26+
27+
# Done
28+
29+
echo "✅ Repo set up. You're now on '$BRANCH'."
30+
31+
echo "You can now make changes and push directly to $USER/stdlib:$BRANCH"

WORKFLOW.md

+39
Original file line numberDiff line numberDiff line change
@@ -109,3 +109,42 @@ The project is usable as CMake subproject. Explicit references to
109109
break subproject builds.
110110
An example project is available [here](https://github.com/fortran-lang/stdlib-cmake-example)
111111
to test the CMake subproject integration.
112+
113+
## GitHub collaboration
114+
115+
Contributing can be daunting, we know! Even more for a big project with many contributors, and if you are not expert on the whole github workflow then even more, we have been there at some point.
116+
117+
In order to help lowering the barrier for collaborating on ongoing efforts (e.g. an open PR), we have crafted a simple script that might come in handy. To explain the process we'll use Alice (the person you want to help) and Bob (you):
118+
119+
┌────────────────────────────┐
120+
│ fortran-lang/stdlib │
121+
└────────────▲───────────────┘
122+
123+
│ [Pull Request]
124+
125+
┌───────┴────────┐
126+
│ alice/stdlib │ ←─────┐
127+
└──────▲─────────┘ │
128+
│ │
129+
[PR Branch] ←───┘ ┌──────┴──────┐
130+
feature-branch │ bob/stdlib │
131+
(hosted here) │ (fork) │
132+
└─────────────┘
133+
134+
135+
[Push access to Alice's repo]
136+
137+
After having forked from `fortran-lang/stdlib` and cloned your `stdlib` fork on your local machine; on an unix compatible terminal with access to the `git` CLI, being at the root folder:
138+
```sh
139+
./.github/collab.sh
140+
```
141+
You will be asked to enter the username and branch of the other person:
142+
```bash
143+
Enter the GitHub username of the fork owner (e.g., alice): alice
144+
Enter the PR branch name (e.g., feature-branch): feature-branch
145+
```
146+
This will fetch Alice's repository and switch your view to Alice's feature-branch. Now you can review, build, run, play around, propose your nice improvements.
147+
148+
Once you finish helping out, you can always `git checkout <your_own_branch>` and/or delet Alice's branch from your local view `git branch -d feature-branch`.
149+
150+
Remember, announce your willingness to help 😉

0 commit comments

Comments
 (0)