-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
docs: tutorial on how to submit a pull request to lb4 #2364
Conversation
Currently, the intention is to link to this tutorial document from the "Contributing to Loopback" sidebar which is defined in the In the online documentation it is this link : https://loopback.io/doc/en/contrib/doc-contrib.html If this is agreed upon by everyone, then I will create a PR for that change in the |
replaces : loopbackio/loopback.io#806 (now closed) |
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.
Looks great 👍, just left some comments/suggestions 😄
docs/site/submitting_a_pr.md
Outdated
|
||
![submit_pr_create_feature_branch_2.png](./imgs/submit_pr_create_feature_branch_2.png) | ||
|
||
Enter the `name` of your new `feature branch` in the search field. Because the branch `emonddr-doc-changes` doesn't yet exist, a menu item to create it appears below the search field. Click on the `Create branch` link. |
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.
Question: would it be good to also show them how to this with the git command as well?
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.
It would be much simpler to do so with git
command:
git clone <your-fork-of-loopback-next>
cd loopback-next
git checkout -b <branch-name-for-your-pr>
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.
BTW, we don't have to repeat what's available in github docs - https://help.github.com/categories/collaborating-with-issues-and-pull-requests/. We can simply link to them if necessary.
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.
@raymondfeng , true...but I was asked in #2280 to give it the "flavour" of this article : https://www.nearform.com/blog/getting-into-open-source-for-the-first-time/ , which does go into some github detail. I figured this is what was desired. Also, is it not more convenient to have the instructions in one place, instead of asking the user to open several other links? I do agree that we can provide a link to that awesome github document you provided in the References section.
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.
@raymondfeng , in my latest commit, I take the user
through these steps:
git clone <your-fork-of-loopback-next>
cd loopback-next
git checkout -b <branch-name-for-your-pr>
as per your suggestion.
docs/site/submitting_a_pr.md
Outdated
You can also see this by typing | ||
|
||
``` | ||
git branch -a |
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.
Maybe git branch
by itself if all they want to see is that they're on the master
branch?
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.
I think we should go directly to git checkout emonddr-doc-changes
. The fewer steps, the better. Please bear in the mind that this tutorial is help our contributors to create a good PR as fast as possible. It's not a learning course for git
or github
.
docs/site/submitting_a_pr.md
Outdated
|
||
Request a code review or document review. | ||
|
||
Add a specific committer to speed up this process. (for example, @bajtos, @raymondfeng). |
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.
Perhaps you could link to their accounts (e.g. [@bajtos](https://github.com/bajtos)
) ?
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.
tbh, I'm not so sure about adding specific maintainer just to speed up the process. :)
For each package, there is a list of codeowners specified in https://github.com/strongloop/loopback-next/blob/master/CODEOWNERS. They are the maintainers who have deeper knowledge in the specified package and the default reviewers of the PR.
I think we can put it as... if you think there are other contributors should be reviewing your PR, you can add them as one of the reviewers.
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.
I was just repeating what is being said in
https://loopback.io/doc/en/contrib/code-contrib.html
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.
So should I instead state the a contributor should look into CODEOWNERS file and pick someone from there?
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.
Code owners will automatically be requested for review
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.
oh, very cool.
I changed that paragraph to
"
Once your PR is created, the appropriate reviewer(s) will be notified. This is determined by the configuration settings in /loopback-next/CODEOWNERS
.
"
docs/site/submitting_a_pr.md
Outdated
|
||
### 21. Merge your pull request | ||
|
||
Finally `merge` your pull request changes into the `master` branch of the `strongloop/loopback-next` [repo](https://github.com/strongloop/loopback-next). |
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.
Correct me if I'm wrong but I don't think people who aren't maintainers have merging rights.
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.
We maintainers are responsible for merging the PR.
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.
+1
Let's rephrase this section to make it clear that the contributor has to wait until project maintainers merge the pull request.
Also please consider adding a section explaining what to do after the pull request was merged - how to update master
branch in origin
to point to the same commit as the master
branch in upstream
.
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.
@bajtos , I have addressed
"
Let's rephrase this section to make it clear that the contributor has to wait until project maintainers merge the pull request.
"
Related to : #2280 |
docs/site/submitting_a_pr.md
Outdated
|
||
Here is a tutorial on how to submit a pull request (PR) for loopback v4. | ||
|
||
### 1. Log in to github |
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.
Before we dive into the details, we should outline the steps for two levels:
- github newbies
- (detailed steps)
- github experts
- (loopback-next specifics)
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.
@raymondfeng , I haven't yet created the "expert" list yet. I have mainly addressed all the other comments. But I will address it soon.
docs/site/submitting_a_pr.md
Outdated
Type `q` to quit viewing the list of branches. | ||
|
||
|
||
### 7. Set up remote tracking |
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.
It is only required if the PR needs to be rebased against the official master. We should move this section to advanced steps.
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.
@raymondfeng , while I worked on this tutorial with a fake PR request in my forked repo, I had to rebase 2 or 3 times. I agree that it is an advanced topic, but my tutorial doesn't break itself into basic
and advanced
sections...it lists all detailed steps in one long list. It is a thorough tutorial for beginners/intermediates. I do agree with you ( from another comment) that we should offer 2 choices for a user to follow. 1) Steps for an advanced user (with barely any content..just an outline), and 2) Steps for a beginner/intermediate (with the detailed steps and pictures as I have been providing).
docs/site/submitting_a_pr.md
Outdated
|
||
Before `staging your changes` (the next step), be sure your files are free of formatting, syntax, and logical/execution errors. | ||
|
||
To flush out any **formatting** issues in code, run `npm run lint`. If there are issues, run `npm run lint:fix`. |
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.
We should recommend npm run lint:fix
directly.
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.
Please note that npm test
will report lint errors.
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.
@nabdelgadir mentioned the same thing. Thanks @raymondfeng .
docs/site/submitting_a_pr.md
Outdated
|
||
To flush out any **logical/execution** issues in code, run `npm run test`. This will run the existing mocha test cases, and any new test cases you have added. If there are issues, fix them, run `npm build`, and run `npm run test` again. Repeat until all issues are gone. | ||
|
||
### 11. Verifying your documentation changes |
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.
We can probably leave it to CI.
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.
I liked your earlier statement:
"
Maybe the simplest approach is npm run lint:fix && npm test
.
"
Also, doesn't CI simply run the same thing that a user runs on his laptop? If so, it would save them time to run on the laptop first, to flush out all problems locally, before submitting the PR.
docs/site/submitting_a_pr.md
Outdated
|
||
|
||
|
||
### 12. Staging your changes |
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.
We should refer to git/github docs to teach folks how to stage/commit/push.
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.
I was asked to use https://www.nearform.com/blog/getting-into-open-source-for-the-first-time/ as inspiration for my document, so that's the "flavour" I followed. We can certainly provide a link to github docs in the References. Like the document you mentioned: https://help.github.com/categories/collaborating-with-issues-and-pull-requests/.
docs/site/submitting_a_pr.md
Outdated
|
||
Please read the [Commit Message Format](https://loopback.io/doc/en/contrib/code-contrib-lb4.html#commit-message-guidelines) guidelines to correctly format your commit message. | ||
|
||
To help with abiding by the rules of commit messages, please use the `commitizen` tool mentioned in the documentation above. This means will we use `git cz` instead of `git commit`. |
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.
git cz
is not available unless you run npm install -g commitizen
.
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.
+1
docs/site/submitting_a_pr.md
Outdated
![submit_pr_git_push_2.png](./imgs/submit_pr_git_push_2.png) | ||
|
||
|
||
### 15. Rebasing |
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.
We should add a section to describe how to add more commits to a given PR. New users are often confused as they don't know the PR automatically picks up the latest version in your branch against the base. There is no need to close the current PR and reopen a new one.
We also should describe what's best practice to add commits to a PR under review.
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.
I actually have a question about commits "before a PR" and "after a PR".
When someone creates a PR for the first time, is it expected that there is 1 commit with a valid commitizen
message? Or does this only matter ONLY before the maintainers merge the PR?
Same question after the PR is created (let's say with 1 commit and valid commitizen message). During the review process, when many commits are added, do they all have to have valid commitizen
messages, or does this only matter ONLY before the maintainers merge the PR?
I asked a few weeks ago, and I was told that every commit message should be a valid commitizen
message.
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.
@raymondfeng , I spoke with @b-admike this morning to address my questions above. My latest commit discusses the number of commits before creating a PR, and when it is about to be merged by maintainers.
docs/site/submitting_a_pr.md
Outdated
![submit_pr_squash_commits_10.png](./imgs/submit_pr_squash_commits_10.png) | ||
|
||
|
||
### 17. Creating the pull request (PR) |
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.
PR can be created before squashing commits, which is usually the final step before the PR is ready to merge.
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.
very detailed instructions! I have a few comments / suggestions. Thanks.
docs/site/submitting_a_pr.md
Outdated
![submit_pr_git_push_2.png](./imgs/submit_pr_git_push_2.png) | ||
|
||
|
||
### 15. Rebasing |
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.
I think for step 15 and 16, we should create a separate section for that.
"What if your PR gets out of date"?
"What if you have multiple commits and want to squash them into one?"
Not all PRs need to go through those 2 steps but in case contributors need to do it, they can follow the instructions there.
docs/site/submitting_a_pr.md
Outdated
|
||
Request a code review or document review. | ||
|
||
Add a specific committer to speed up this process. (for example, @bajtos, @raymondfeng). |
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.
tbh, I'm not so sure about adding specific maintainer just to speed up the process. :)
For each package, there is a list of codeowners specified in https://github.com/strongloop/loopback-next/blob/master/CODEOWNERS. They are the maintainers who have deeper knowledge in the specified package and the default reviewers of the PR.
I think we can put it as... if you think there are other contributors should be reviewing your PR, you can add them as one of the reviewers.
lang: en | ||
keywords: contributing, LoopBack community, pull request, PR, loopback | ||
sidebar: contrib_sidebar | ||
permalink: /doc/en/lb4/submitting_a_pr.html |
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.
How about /doc/en/lb4/submitting_patches.html
?
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.
@bajtos , the title is "submitting a pull request", the MD file is "submitting_a_pr.md", so I figured that we should keep the HTML file name consistent with "submitting_a_pr.html" . Do we want to change the title of the document?
docs/site/submitting_a_pr.md
Outdated
|
||
Please read the [Commit Message Format](https://loopback.io/doc/en/contrib/code-contrib-lb4.html#commit-message-guidelines) guidelines to correctly format your commit message. | ||
|
||
To help with abiding by the rules of commit messages, please use the `commitizen` tool mentioned in the documentation above. This means will we use `git cz` instead of `git commit`. |
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.
+1
docs/site/submitting_a_pr.md
Outdated
|
||
### 21. Merge your pull request | ||
|
||
Finally `merge` your pull request changes into the `master` branch of the `strongloop/loopback-next` [repo](https://github.com/strongloop/loopback-next). |
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.
+1
Let's rephrase this section to make it clear that the contributor has to wait until project maintainers merge the pull request.
Also please consider adding a section explaining what to do after the pull request was merged - how to update master
branch in origin
to point to the same commit as the master
branch in upstream
.
@bajtos , regarding |
@bajtos , concerning: " I was wondering if we should have the user
Will they be using any of these afterwards...if everything is fine? This article, mentioned in #2280, https://www.nearform.com/blog/getting-into-open-source-for-the-first-time/, has some clean up steps at the end. Deleting the feature branch of the forked repo, and then rebasing so the master branch of the forked repo is up to date with original repo. But what is the point? Isn't it cleaner and more efficient to delete everything that is no longer needed? I would appreciated your feedback in this matter. thanks. :) |
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.
Good stuff. The steps have covered all the scenarios I met when reviewing community PRs.
I left some comments.
docs/site/submitting_a_pr.md
Outdated
|
||
To flush out any **syntax** issues in code, run `npm run build`. If there are issues, fix them, and run `npm run build` again. Repeat until all issues are gone. | ||
|
||
To flush out any **logical/execution** issues in code, run `npm run test`. This will run the existing mocha test cases, and any new test cases you have added. If there are issues, fix them, run `npm build`, and run `npm run test` again. Repeat until all issues are gone. |
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.
+1 ^
I usually run npm test
to make sure all tests pass first then fix the lint error. And npm run lint
automatically runs as the post test script.
If tests are all green but npm run lint
fails, I run npm run lint:fix
or manually fix the formatting issues(some cannot be fixed by script)
docs/site/submitting_a_pr.md
Outdated
|
||
To flush out any **syntax** issues in code, run `npm run build`. If there are issues, fix them, and run `npm run build` again. Repeat until all issues are gone. | ||
|
||
To flush out any **logical/execution** issues in code, run `npm run test`. This will run the existing mocha test cases, and any new test cases you have added. If there are issues, fix them, run `npm build`, and run `npm run test` again. Repeat until all issues are gone. |
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.
And my understanding for command npm run build
is it mainly generates the codes in dist
folder.
If you read the scripts in package.json
: https://github.com/strongloop/loopback-next/blob/master/package.json#L48-L55
clean
and build
scripts are run as pretest and lint
script is run as posttest, which means npm run test
starts from cleaning your workspace, rebuilds your project to make sure the compiled codes are based on the latest src
file, runs all tests, finally checks the format.
docs/site/submitting_a_pr.md
Outdated
|
||
The next prompt asks if any `breaking changes` will be introduced. | ||
|
||
![submit_pr_git_cz_8.png](./imgs/submit_pr_git_cz_8.png) |
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.
I like this prompts that forces people rethink if their code contain breaking change.
Type : | ||
|
||
``` | ||
git push |
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.
I am not sure if git push
works here...usually I run git push origin +{branch_name}
. And especially after a rebasing, I have to force push the commits.
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.
works for me :)
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.
I see what you mean, @jannyHou . If a user creates the feature branch on the web ui, and then clones from command line, they can do : git push .
But if user forks in the web ui, and then creates the feature branch from the command line, they cannot do a simple : git push .
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.
git push
command will prompt how to track the remote branch.
docs/site/submitting_a_pr.md
Outdated
|
||
I want to keep the commit message from the first commit, so I will leave the word `pick` in front of the first commit, and change the words from `pick` to `squash` for the second and third commits. (Use the `arrow` keys to move around, and the `delete` or `backspace` key for deleting characters) | ||
|
||
![submit_pr_squash_commits_5.png](./imgs/submit_pr_squash_commits_5.png) |
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.
A nitpick for the commands: you can a single letter for short, like
p 88bc27c5 docs: some description
s 67ac02a7 docs: some other description
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.
hmm, for beginners/intermediates... I prefer to put full words. :)
docs/site/submitting_a_pr.md
Outdated
|
||
Please read the [Commit Message Format](https://loopback.io/doc/en/contrib/code-contrib-lb4.html#commit-message-guidelines) guidelines to correctly format your commit message. | ||
|
||
To help with abiding by the rules of commit messages, please use the `commitizen` tool mentioned in the documentation above. This means will we use `git cz` instead of `git commit`. |
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 git cz
support add sign-off message? After switching to DCO every commit needs author to sign off.
Would be equivalent to git commit -s -m 'fix: some description'
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.
commitizen
does support signoff. when you enter the long description, you specify:
my long description.\n\nSigned-off-by: Dominique Emond <[email protected]>
and this would provide a commit message like:
docs: tutorial on how to submit a pull request to lb4
This tutorial shows contributors step-by-step instructions on how to submit a pull request (PR) to Loopback v4
Signed-off-by: Dominique Emond <[email protected]>
I initially prepared my tutorial for steps involving DCO, but @dhmlau has informed me to prepare it with the CLA
approach; since DCO is not approach is not 100% certain.
@raymondfeng @bajtos @dhmlau , when someone first creates the pull request, is it important that Then, during the review phase, the contributor adds more commits with messages. Then, at the end, there is a final The reason I am asking is because I want to know if the I know that if I were a maintainer, I would like to look at 1 commit, and 1 commit message...at least initially. This article, https://www.nearform.com/blog/getting-into-open-source-for-the-first-time/, mentioned in #2280, also mentions rebasing just before creating a pull request. He doesn't mention squashing commits, however. Today I spoke with Biniam , @b-admike , about this and he clarified a few things. My latest commit has my changes. |
There are different point in time that the user needs to rebase and squash the commits. Here are my thoughts:
|
Suggest that you link directly to Contributing code/LoopBack 4 (https://loopback.io/doc/en/contrib/code-contrib-lb4.html) in Step 9. The Contributing code link can open the LB4 page. Currently it links to (http://localhost:4001/doc/en/contrib/code-contrib.html, a 3.x page.
|
I like the detailed walkthrough for github newbies. But 18 steps is scary :-). Please separate the ones that are common to all github repos from those extras/specifics for loopback-next. At the top of the tutorial, allow fluent github users to go directly to our special requirements. Let's think about how many mins are needed to read and how many steps to go through. It’s critical to keep them minimal. Use the TL;DR style if necessary. By our experience, most users struggle with or do not pay attention to the following:
These are the pain points that deserve more words/diagrams. |
docs/site/submitting_a_pr.md
Outdated
Use the template to fill in as much information as possible to properly describe | ||
the purpose of the pull request. | ||
|
||
{% include tip.html content="The title of the pull request should start with <b>[WIP]</b> for <b>work in progress</b> when the pull request is not complete yet." %} |
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.
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.
@dmlau , I read about them just now, and there isn't any indication they can be distinguished from normal PRs in the UI. So having [WIP] would still be useful in the title.
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.
Thanks for trimming down the instructions.
In general, I'm thinking perhaps we could further trim down some of the explanation (see review comments) too.
Open a terminal window, and navigate to the directory where you want to clone | ||
the repository. In my case, this is `/Users/dremond/git` . | ||
|
||
To create the `feature` branch, run: |
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.
I'm thinking we can even further trim down the above content in this step and starts from here.
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.
Yeah I think if we say follow the steps on how to clone the repository and link them to https://help.github.com/en/articles/cloning-a-repository, it would be sufficient.
It is not necessary to create a pull request immediately on the push of your | ||
first commit; this can be done later. | ||
|
||
Do take some time to think about how many commits you want in the pull request |
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.
perhaps line 198-204 can be in one paragraph?
I'm thinking whether we need to be verbose about that, or simply show how. Thoughts, @raymondfeng?
|
||
### 6. Rebasing | ||
|
||
Eventually your fork of the original repository will become stale, and it will |
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.
maybe use if
instead of eventually
? because someone will be "lucky" enough that the PR got merged before it becomes stale. :)
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.
Suggested changes:
If your fork becomes stale at any point in time, you can bring it up-to-date by rebasing your PR.
<here are the steps>
then it goes directly to ur next snippet git remote...
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.
+1. stale
is a bit confusing too. Maybe we should say your branch is behind the original/master
.
git push --force-with-lease origin { your feature branch } | ||
``` | ||
|
||
Now we can see that the copy of the repository is no longer behind in several |
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.
maybe we don't need line 241-251?
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.
We can directly rebase against origin/master for your feature branch:
git checkout { your feature branch }
git rebase upstream/master (or git pull --rebase upstream master)
git push --force-with-lease
docs/site/submitting_a_pr.md
Outdated
It a **necessary** step `after` the pull request has been created, | ||
reviewed, approved and is about to be merged by the maintainers. | ||
|
||
Before creating a pull request, you can choose to squash your commits into one |
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.
similar for this paragraph and next... I'm thinking whether we can just skip this and just show the how.
docs/site/submitting_a_pr.md
Outdated
|
||
![submit_pr_rebase_2.png](./imgs/submit_pr_rebase_2.png) | ||
|
||
### 7. Squashing commits |
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.
We usually squash commit after the code review and before merge.
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.
I have 3 new review comments on some nitpicks (GitHub
and the extra space after bracket), other than that, LGTM.
Please get a review from @raymondfeng to make sure his idea of splitting the new vs experienced GH users is captured.
docs/site/submitting_a_pr.md
Outdated
|
||
Here are instructions on how to submit a pull request (PR) for LoopBack v4. | ||
|
||
If you are a github expert, please follow the |
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.
github
-> GitHub
docs/site/submitting_a_pr.md
Outdated
If you are a github expert, please follow the | ||
[Expert instructions](#expert-instructions) below. | ||
|
||
If you are a github beginner, please follow the |
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.
github
-> GitHub
docs/site/submitting_a_pr.md
Outdated
|
||
#### 2. Create the feature branch | ||
|
||
Notice your repo has a `master` branch already created ( refer bottom left |
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.
extra space after (
docs/site/submitting_a_pr.md
Outdated
npm run lint:fix && npm run test | ||
``` | ||
|
||
To ensure your `documentation` files are free of formatting errors, run : |
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.
I think we can defer this step to CI.
docs/site/submitting_a_pr.md
Outdated
click on `LoopBack 4`, and verify that your documentation changes appear and are | ||
well-rendered. | ||
|
||
#### 4. Conventional Commits |
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.
IMO, this section should be the 1st one as we want to make sure our contributors follow it during commits before a PR is created.
I prefer to order these steps based on contributors' flow. For example:
- during commit to local repo (Conventional Commits)
- before push to remote repo (npm run lint:fix && npm test)
- right after create a PR (sign CLA)
- after CI reports status for the PR (Check CI failures)
- before merge (Clean up commit history if needed)
docs/site/submitting_a_pr.md
Outdated
### Expert Instructions | ||
|
||
In addition to your knowledge about github and creating a pull request, we have | ||
additional steps you need to follow when submitting a pull request for |
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.
additional steps --> specific conventions
|
||
Our commit messages are formatted according to | ||
[Conventional Commits](https://conventionalcommits.org/). | ||
|
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.
We should advise contributors to run npm i
for loopback-next
. It will create a commit-msg
hook under loopback-next/.git/pre-commit
, which enforces the conventional commit rules automatically.
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.
Well done @emonddr 👍 pretty good read and guide with explicit examples along the way. I like the way it's split for advanced users and new ones as @raymondfeng and others have suggested. There might be more areas we can trim down as @dhmlau pointed out.
docs/site/submitting_a_pr.md
Outdated
This tutorial is about how to submit a pull request (PR) for LoopBack 4 while | ||
following our conventions and requirements. | ||
|
||
Pick `Expert Instructions` or `Beginner Instructions` mode based your experience |
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.
nitpick: based your
-> based on your
docs/site/submitting_a_pr.md
Outdated
#### 2. Before pushing to remote repository | ||
|
||
Before pushing to the remote repository, ensure your files are free of | ||
formatting, syntax, and logical/execution errors, by running : |
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.
nitpick: running :
-> running:
(I personally leave the comma out before by running
too, but feel free to keep it)
The review process is iterative, so it is normal that `multiple commits` may be | ||
required until the pull request is finally accepted. | ||
|
||
{% include tip.html content="After a pull request is created, any additional commits that you push to your remote feature branch automatically get added to the pull request. There is no need to close the initial pull request and create a new one." %} |
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.
👍
docs/site/submitting_a_pr.md
Outdated
{% include tip.html content="After a pull request is created, any additional commits that you push to your remote feature branch automatically get added to the pull request. There is no need to close the initial pull request and create a new one." %} | ||
|
||
Reactively [rebase](https://help.github.com/articles/about-git-rebase/) your | ||
forked repository against the upstream master branch to keep them in synch; if |
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.
nitpick: synch
-> sync
perhaps?
docs/site/submitting_a_pr.md
Outdated
forked repository against the upstream master branch to keep them in synch; if | ||
needed. | ||
|
||
#### Before your PR is merged by maintainer |
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.
nitpick: by maintainer
-> by a maintainer
or by maintainers
This brings up tiny dialog with different choices : Clone with SSH, Use HTTPS, | ||
Open in Desktop, or Download Zip. | ||
|
||
In my case, I will leave it as `Clone with SSH`, and click on the |
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.
Can we leave a note here that Clone with SSH
option requires you to have SSH set up on your local client machine? If they use HTTPS, I believe they would have to enter their GitHub credentials.
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.
hmm. I keep getting told that I have to trim information down. Not sure I want to start showing them the steps of using https. they can look it up.
Open a terminal window, and navigate to the directory where you want to clone | ||
the repository. In my case, this is `/Users/dremond/git` . | ||
|
||
To create the `feature` branch, run: |
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.
Yeah I think if we say follow the steps on how to clone the repository and link them to https://help.github.com/en/articles/cloning-a-repository, it would be sufficient.
docs/site/submitting_a_pr.md
Outdated
inside in the local feature branch directory. | ||
|
||
To ensure your files are free of formatting, syntax, and logical/execution | ||
errors, run : |
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.
nitpick: run :
-> run:
docs/site/submitting_a_pr.md
Outdated
|
||
``` | ||
|
||
To start `commitizen`, run : |
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.
ditto with run :
-> run:
and anywhere else you might have that space (don't want to bombard you with nitpick comments :-) )
``` | ||
git remote add upstream [email protected]:strongloop/loopback-next.git | ||
git checkout master | ||
git pull --rebase upstream master |
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 rebase command go into an interactive rebase?
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.
not it just pulls everything down.
docs/site/submitting_a_pr.md
Outdated
formatting, syntax, and logical/execution errors, by running : | ||
|
||
``` | ||
npm run lint:fix && npm run test |
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.
npm run lint:fix && npm test
Please note that npm run lint:fix
might reformat the source code and fix style issues. Please add such changes to your commit.
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.
Please change to npm run lint:fix && npm test
docs/site/submitting_a_pr.md
Outdated
|
||
#### 3. After creating PR, sign the CLA and fill out checklist | ||
|
||
After creating the pull request, sign the Contributor License Agreement (CLA). |
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.
make sure the Contributor License Agreement (CLA) has been signed for the loopback-next
repository.
docs/site/submitting_a_pr.md
Outdated
This tutorial is about how to submit a pull request (PR) for LoopBack 4 while | ||
following our conventions and requirements. | ||
|
||
Pick `Expert Instructions` or `Beginner Instructions` mode based your experience |
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.
Please add in-page links to each mode.
#### 4. Check CI status | ||
|
||
Ensure that the continuous integration (CI) jobs associated with your pull | ||
request complete successfully. |
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.
It might take some time for CI jobs to be scheduled and completed.
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.
We should tell contributors to click on Details
for failing items to check. It might be nice to have a screenshot of travis CI report.
@b-admike , concerning |
@nabdelgadir suggested we can place one link to my document here: and a link to my document somewhere here: since a PR can be for "code" or for "docs" |
docs/site/submitting_a_pr.md
Outdated
|
||
Run `npm install` inside `loopback-next` after `git clone`. This will | ||
automatically set up git `commit-msg` hooks to check the conventions and block | ||
invalid messages. |
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.
IIRC, there is a macro we can use to highlight the paragraph as NOTE.
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.
{% include note.html content=...%}
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.
@raymondfeng addressed this comment.
![submit_pr_create_feature_branch_2.png](./imgs/submit_pr_create_feature_branch_2.png) | ||
|
||
Open a terminal window, and navigate to the directory where you want to clone | ||
the repository. In my case, this is `/Users/dremond/git` . |
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.
nitpick: Using git
as the directory is confusing. It would be better to use something like /Users/dremond/Projects
.
To stage one untracked file at a time, run: | ||
|
||
``` | ||
git add { relative path to file from root directory } |
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.
We can add a tip to use git gui
.
|
||
If, however, it makes more sense to place your changes into a few logically | ||
separate commits, then do so. | ||
|
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.
This paragraph does not add much value unless we have some best practice for them to follow.
docs/site/submitting_a_pr.md
Outdated
forked repository against the upstream master branch to keep them in sync; if | ||
needed. | ||
|
||
#### Before your PR is merged by a maintainer |
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.
Missing the item number such as #### 6. ...
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.
good catch. How did I miss that? oh well.
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.
Please fix https://github.com/strongloop/loopback-next/pull/2364/files#r260033805 and squash commits before merge.
@raymondfeng , addressed latest comment, rebased, and squashed commits into one. |
This tutorial shows contributors step-by-step instructions on how to submit a pull request (PR) to Loopback v4
This tutorial shows contributors step-by-step instructions on how to submit a pull request (PR) to
Loopback v4