|
| 1 | +# Guides and FAQs for first-time contributors |
| 2 | + |
| 3 | +Welcome to the Node.js project! This guide is complementary to the |
| 4 | +[general contribution guidelines](../../CONTRIBUTING.md) |
| 5 | +and the [pull request guidelines](./pull-requests.md), with a focus on |
| 6 | +clarifying the process for first-time contributors. |
| 7 | + |
| 8 | +## Before you start |
| 9 | + |
| 10 | +Read and understand [Code of Conduct](./code-of-conduct.md) before contributing to the project. |
| 11 | + |
| 12 | +## Getting started with issues |
| 13 | + |
| 14 | +If your first contribution is not motivated by an issue you already encounter, but you just want to help, |
| 15 | +you can find issues to work on by browsing the [issue tracker](https://github.com/nodejs/node/issues). |
| 16 | +Filter issues by the `good first issue` label to find issues that are suitable for first-time |
| 17 | +contributors. `help wanted` tracks issues that need volunteers to help but may be more challenging |
| 18 | +due to complexity or requiring special domain expertise. |
| 19 | + |
| 20 | +If your first contribution is motivated by an issue you already encounter, but your proposed change |
| 21 | +is complex, introduces a new feature, breaks backward compatibility, or needs a significant refactor, |
| 22 | +it can be useful to open an issue to discuss whether the change or its design is acceptable before |
| 23 | +working out the implementation details. The issue can be opened before you send the pull request, |
| 24 | +or along side your pull request (in which case, it's better to keep the pull request in draft mode). |
| 25 | + |
| 26 | +Straightforward or non-controversial changes, such as an obvious bug fix or a small refactor, don't |
| 27 | +usually benefit from discussions in a separate issue, and can be sent directly as a pull request. |
| 28 | + |
| 29 | +### Communicating in issues |
| 30 | + |
| 31 | +Node.js is a community project driven by volunteers. There are no project managers to |
| 32 | +assign issues to people. There's no need to ask for assignments on GitHub. |
| 33 | +Instead, contributors usually use comments to communicate progress. |
| 34 | + |
| 35 | +Refrain from taking on issues with a comment but not following through. If the issue is |
| 36 | +straightforward, you can start working on it right away. If the task is more complex, |
| 37 | +it is okay to leave updates on the issue when you have significant findings or run into |
| 38 | +blockers before you have a pull request ready to avoid duplicate work by other contributors. |
| 39 | + |
| 40 | +Avoid picking multiple issues at the same time, especially issues of the same type or area. |
| 41 | +It's better to focus on one issue and see it through to completion before picking another one. |
| 42 | + |
| 43 | +During communication, be conscious of the length of your comments. Long comments can be difficult |
| 44 | +to read and may discourage others from engaging in the discussion. Refrain from pasting large |
| 45 | +blocks of code, logs, or text generated by tools. If necessary, use `<details>` tags to fold |
| 46 | +them into a collapsible section to make the discussion more readable. |
| 47 | + |
| 48 | +## What NOT to do for your first contributions |
| 49 | + |
| 50 | +**Refrain from automating your first contributions**. In this project, automation must |
| 51 | +be authorized and tracked explicitly. If you have an idea for automation, please open an |
| 52 | +issue to discuss it with other contributors first. |
| 53 | + |
| 54 | +**Refrain from submitting large pull requests for your first contributions**. Node.js makes |
| 55 | +technical decisions through a |
| 56 | +[consensus-seeking process among its collaborators](./collaborator-guide.md#consensus-seeking), |
| 57 | +with additional community feedback taken into account. Pushing a complex change through |
| 58 | +this process can be difficult even for experienced contributors, and discouraging for |
| 59 | +first-time contributors. It's best to start with smaller, focused pull requests that |
| 60 | +address known issues, allowing you to familiarize yourself with the collaboration |
| 61 | +process first. When you have to submit a large pull request after gaining some experience, |
| 62 | +make sure to follow the [large pull request guidelines](./large-pull-requests.md). |
| 63 | + |
| 64 | +**Refrain from opening new Pull Requests before the first one has been approved**. |
| 65 | +This gives others the first impression that you are flooding the project. |
| 66 | +It's OK to not get everything right on the first try, but if you open PRs faster |
| 67 | +than they are reviewed, you are wasting an opportunity to improve, and can overwhelm |
| 68 | +both yourself and your reviewers with notifications. |
| 69 | + |
| 70 | +## Going through the pull request review process |
| 71 | + |
| 72 | +When you are ready to submit a pull request, check out the [pull request guidelines](./pull-requests.md) |
| 73 | +for the technical how-tos and explanations about the review process. |
| 74 | + |
| 75 | +First-time contributors should be aware that this project uses |
| 76 | +[Developer Certificate of Origin (DCO)](https://developercertificate.org/) to manage |
| 77 | +the copyright of contributions. Make sure to |
| 78 | +[sign off your commits](./pull-requests.md#step-4-commit) (e.g., using `git commit -s`), |
| 79 | +or they cannot be merged. |
| 80 | + |
| 81 | +## FAQs about pull requests |
| 82 | + |
| 83 | +### Q: Why is my pull request not getting reviews? |
| 84 | + |
| 85 | +In Node.js, the group of people that can approve pull requests to be merged are |
| 86 | +[the collaborators](../../GOVERNANCE.md#collaborators). While there are many of them, they |
| 87 | +are volunteers with limited bandwidth, and don't always pay attention to new |
| 88 | +pull requests, since the project is big and the volume of notifications can be overwhelming. |
| 89 | + |
| 90 | +When your pull request is not getting attention, you can |
| 91 | + |
| 92 | +1. Try pinging collaborators who have shown interest in the original issues. |
| 93 | +2. Try asking for help in the |
| 94 | + [#node-core channel on the OpenJS Slack](https://openjs-foundation.slack.com/archives/C019Y2T6STH). |
| 95 | + |
| 96 | +**Be patient and respect the time the reviewers put in as volunteers**. People are usually |
| 97 | +happier to help if you are polite and show respect for their voluntary review efforts. |
| 98 | + |
| 99 | +### Q: There are some review comments on my pull request. How should I update my pull request to address them? |
| 100 | + |
| 101 | +If the review comments are left with GitHub's suggestion feature, you can apply the suggestions |
| 102 | +directly in the GitHub UI and commit the changes to your branch. Otherwise, you can push new commits to |
| 103 | +the pull request branch. See [the pull request guide](./pull-requests.md#step-9-discuss-and-update) for |
| 104 | +the technical how-tos. |
| 105 | + |
| 106 | +After you push new commits, even if the previous commits have been approved, you will still need a |
| 107 | +new approval for the last commits. |
| 108 | + |
| 109 | +Commits in the same pull requests are usually squashed into one commit before landing, unless |
| 110 | +there's a good justification to keep them separate - in that case, coordinate with your reviewers |
| 111 | +about this. The commits that need to be kept separate must each pass all tests on their own and |
| 112 | +follow the [commit message guidelines](./pull-requests.md#commit-message-guidelines). |
| 113 | + |
| 114 | +Commit squashing is usually handled by the automation. Commits that are intended to be squashed away don't |
| 115 | +have to follow the commit message guidelines - only the ones whose commit message will be kept after |
| 116 | +squashing do. If your commits are already approved and the CI has passed on them, don't worry |
| 117 | +about squashing them yourself - the automation will take care of it during landing. |
| 118 | + |
| 119 | +The automation uses `git rebase --autosquash` which can pick up hints left by |
| 120 | +[`--fixup`](https://git-scm.com/docs/git-commit#Documentation/git-commit.txt---fixupamendrewordcommit) and |
| 121 | +[`--squash`](https://git-scm.com/docs/git-commit#Documentation/git-commit.txt---squashcommit) flags of the |
| 122 | +`git commit` command. You can use these flags when adding new commits to your pull request to indicate how |
| 123 | +the squashing should be done. |
| 124 | + |
| 125 | +### Q: I've updated my pull request, but there's no response. What should I do? |
| 126 | + |
| 127 | +When you update your pull request, reviewers may not get notified automatically, depending on how |
| 128 | +they configure their notifications. They can also miss the notification, or just do not have the bandwidth |
| 129 | +to serve as volunteers in the project at the moment. You can try pinging them again to let them know about the |
| 130 | +updates. Be patient and don't overwhelm them with pings. As a reference, the general expected |
| 131 | +cadence for reviewers to respond to pull requests is around |
| 132 | +[48 hours to 7 days](./collaborator-guide.md#code-reviews). |
| 133 | + |
| 134 | +### Q: There is a merge conflict in my pull request. What should I do? |
| 135 | + |
| 136 | +When the target branch is updated and there is now a merge conflict in the pull request, you will |
| 137 | +need to rebase your pull request branch on top of the latest version of the target branch and |
| 138 | +resolve the conflicts locally, then force-push the updated branch to your fork. |
| 139 | +See [the pull request guide](./pull-requests.md#step-9-discuss-and-update) |
| 140 | +for the technical how-tos. After a rebase, you will need a new approval from the reviewers. |
| 141 | + |
| 142 | +**Do not use the GitHub web UI to resolve merge conflicts**. The merge commit it creates can lead to issues in the CI. |
| 143 | + |
| 144 | +### Q: What CI checks does my pull request need to pass? |
| 145 | + |
| 146 | +Node.js uses two CI systems: [Jenkins](https://ci.nodejs.org/) and GitHub Actions. Jenkins is the primary |
| 147 | +CI system for testing pull requests, while GitHub Actions is used for quick checks and additional |
| 148 | +verifications. Pull requests that only touch documentation need to pass only the GitHub Actions |
| 149 | +checks. Pull requests that touch more than just documentation will be labeled `needs-ci` and will need |
| 150 | +to run the Jenkins CI before they can be merged. |
| 151 | + |
| 152 | +### Q: How do I trigger the CI runs? |
| 153 | + |
| 154 | +Because GitHub Actions workflows can access sensitive tokens, for your first pull request in |
| 155 | +the repository, a collaborator needs to explicitly approve the workflow run. Once you |
| 156 | +have one pull request merged, later pull requests will trigger GitHub Actions automatically without |
| 157 | +needing approval. |
| 158 | + |
| 159 | +Due to similar security concerns, Jenkins CI runs can only be triggered by collaborators and |
| 160 | +triagers who have the permission to apply the `request-ci` label. But because the Jenkins CI tests |
| 161 | +a large matrix of platforms and configurations, and the infrastructure resources are limited, |
| 162 | +Jenkins CI runs always have to be triggered by humans and won't run automatically. When your |
| 163 | +pull request is ready for CI, you will need to ask for help from collaborators or triagers to |
| 164 | +trigger the Jenkins CI runs. |
| 165 | + |
| 166 | +It takes time for a volunteer to verify that the pull request does not contain malicious code |
| 167 | +before approving the CI runs. Similar to the review process, be patient and respectful of |
| 168 | +the volunteers' time when you are asking for help to trigger the CI runs, this helps build |
| 169 | +trust to make future contributions smoother. |
| 170 | + |
| 171 | +### Q: The CI runs showed some failures that seem unrelated to my change. What should I do? |
| 172 | + |
| 173 | +The Node.js CIs are known to be flaky. Consult the daily reports in |
| 174 | +[the reliability repository](https://github.com/nodejs/reliability/issues) to see if the same failures |
| 175 | +are showing up in other pull requests - if they do, it's very likely that they are unrelated to your |
| 176 | +change. In this case, you can ignore those failures and ask for help to trigger the CI runs again - |
| 177 | +often, these failures are intermittent and will disappear in the next run. |
| 178 | + |
| 179 | +Tip: the flakes have been plaguing the project for a long time because there aren't enough volunteers |
| 180 | +to fix them. If you have the time and interest, try volunteering to fix the ones that you are |
| 181 | +confident with! See the |
| 182 | +[reliability repository README](https://github.com/nodejs/reliability#protocols-in-improving-ci-reliability) |
| 183 | +for more details on how to get started. |
| 184 | + |
| 185 | +### Q: My pull request has enough approvals and passed CI, but it still hasn't been merged. What should I do? |
| 186 | + |
| 187 | +Pull requests need to be merged by collaborators or triagers (normally by applying the `commit-queue` |
| 188 | +label). The [commit queue automation](../../.github/workflows/commit-queue.yml) |
| 189 | +will verify that the pull request meets all the requirements before merging it, but the |
| 190 | +triggering of the commit queue still requires human judgement and depends on volunteers. |
| 191 | +You can ask for help either in the pull request or in the Slack channel similar |
| 192 | +to how you ask for help to get reviews and trigger CI runs. |
| 193 | + |
| 194 | +### Q: There's a comment saying that my pull request is landed, but instead I see my pull request closed, what happened? |
| 195 | + |
| 196 | +In this project, pull requests are typically merged by the |
| 197 | +[commit queue](../../.github/workflows/commit-queue.yml) to amend the commit with |
| 198 | +necessary metadata, not through the GitHub UI. Sometimes the automation or the collaborator |
| 199 | +performing the merge can update the branches in a way that GitHub recognizes it as a merge |
| 200 | +and shows a purple "merged" status, sometimes it's not the case. |
| 201 | +As long as you see a comment saying that your pull request is landed, and the commits do appear |
| 202 | +in the target branch of your pull request, don't worry, it means the change has been effectively |
| 203 | +merged, regardless of what GitHub shows. |
| 204 | + |
| 205 | +### Q: When will my change be released? |
| 206 | + |
| 207 | +If the pull request is not `semver-major`, commits merged into the `main` branch are typically |
| 208 | +first released in next "Current" release. After spending at least two weeks in the "Current" release, |
| 209 | +a change that is not `semver-major` will be eligible to be included in the next "LTS" releases. |
| 210 | +The "Current" and "LTS" releases follow schedules that are tracked in the |
| 211 | +[Release Working Group's pinned issues](https://github.com/nodejs/Release/issues). |
| 212 | + |
| 213 | +If the change is labeled `dont-land-*`, it will be held back from releases in the specified branch until |
| 214 | +the label is removed. |
| 215 | + |
| 216 | +If the change is labeled `semver-major`, it will not be included in the next "Current" release. |
| 217 | +Instead, it will need to wait until the next major release cut from the `main` branch to be included in a |
| 218 | +release. This may take up to months, depending on when the pull request is merged. |
| 219 | + |
| 220 | +Commits on `main` are backported to the release staging branches using `git cherry-pick` before they can be released. |
| 221 | +See [the backporting guide](./backporting-to-release-lines.md). This process is typically performed by |
| 222 | +volunteers from the Release Working Group, but other volunteers can also help. If your change isn't making |
| 223 | +progress in the backporting process as expected, you can ask for help in the Slack channel and see if |
| 224 | +volunteering to backport your change yourself would help. |
| 225 | + |
| 226 | +### Q: Someone commented in my pull request that the change doesn't land cleanly on a release branch, what should I do? |
| 227 | + |
| 228 | +When the volunteers cherry-pick your commits to the release branches, if there's a git conflict, or |
| 229 | +there's a test failure caused by the change, and the volunteer cannot confidently resolve these |
| 230 | +issues on their own, they will leave this comment in the original pull request to ask for help. |
| 231 | +When you see this comment, try backporting by opening a backport pull request yourself. |
| 232 | +See [the backporting guide](./backporting-to-release-lines.md) for the technical how-tos. |
| 233 | + |
| 234 | +If no one follows through with the backporting, your pull request may not be included in |
| 235 | +any releases until the next major release cut from the `main` branch. |
0 commit comments