Skip to content

Commit a010eb7

Browse files
authoredJun 6, 2018
Adding CONTRIBUTION.md
Explaining how people can contribute to this project
1 parent d699df4 commit a010eb7

File tree

1 file changed

+143
-0
lines changed

1 file changed

+143
-0
lines changed
 

‎CONTRIBUTING.md

+143
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
## Contributing
2+
3+
First off, thank you for considering contributing to HIBP. It's people
4+
like you that make HIBP such a great tool for anyone who needs to check
5+
if a given password was previously used in a service that was breached
6+
and listed in [Have I Been Pwned?](https://haveibeenpwned).
7+
8+
### 1. Where do I go from here?
9+
10+
If you've noticed a bug or have a question, [search the issue tracker](https://github.com/dragonbe/hibp/issues?q=something)
11+
to see if someone else in the community has already created a ticket.
12+
If not, go ahead and [make one](https://github.com/dragonbe/hibp/issues/new)!
13+
14+
### 2. Fork the project and create a branch
15+
16+
If this is something you think you can fix, then
17+
[fork HIBP](https://help.github.com/articles/fork-a-repo)
18+
and create a branch with a descriptive name.
19+
20+
A good branch name would be (where issue #123 is the ticket you're working on):
21+
22+
```sh
23+
git checkout -b 123-fixing-nasty-issue
24+
```
25+
26+
### 3. Get the test suite running
27+
28+
Make sure you're using the most recent PHP version:
29+
30+
- This project uses PHP 7.2 or higher
31+
32+
Now install PHP packages using [composer](https://getcomposer.org):
33+
34+
```sh
35+
composer install
36+
```
37+
38+
At this point you should be able to run the entire test suite using:
39+
40+
```sh
41+
./vendor/bin/phpunit
42+
```
43+
44+
### 4. Did you find a bug?
45+
46+
* **Ensure the bug was not already reported** by [searching all
47+
issues](https://github.com/dragonbe/hibp/issues?q=).
48+
49+
* If you're unable to find an open issue addressing the problem, [open a new
50+
one](https://github.com/dragonbe/hibp/issues/new). Be sure to
51+
include a **title and clear description**, as much relevant information as
52+
possible, and a **code sample** or an **executable test case** demonstrating
53+
the expected behavior that is not occurring.
54+
55+
### 5. Implement your fix or feature
56+
57+
At this point, you're ready to make your changes! Feel free to ask for help;
58+
everyone is a beginner at first :smile_cat:
59+
60+
### 6. Make a Pull Request
61+
62+
At this point, you should switch back to your master branch and make sure it's
63+
up to date with HIBP's master branch:
64+
65+
```sh
66+
git remote add upstream git@github.com:dragonbe/hibp.git
67+
git checkout master
68+
git pull upstream master
69+
```
70+
71+
Then update your feature branch from your local copy of master, and push it!
72+
73+
```sh
74+
git checkout 123-update-be-vat-numbers
75+
git rebase master
76+
git push --set-upstream origin 123-fixing-nasty-issue
77+
```
78+
79+
Replace `123-fixing-nasty-issue` with the branch name you have given yourself.
80+
81+
Finally, go to GitHub and
82+
[make a Pull Request](https://help.github.com/articles/creating-a-pull-request)
83+
:D
84+
85+
Travis CI will run our test suite against all supported PHP versions. We care
86+
about quality, so your PR won't be merged until all tests pass. It's unlikely,
87+
but it's possible that your changes pass tests in one PHP version but fails in
88+
another. In that case, you'll have to setup your development environment (as
89+
explained in step 3) to use the problematic PHP version, and investigate
90+
what's going on!
91+
92+
The [PHP containers on Docker HUB](https://hub.docker.com/_/php) might be
93+
convenient for this purpose. You might want to make use of them.
94+
95+
### 7. Keeping your Pull Request updated
96+
97+
If a maintainer asks you to "rebase" your PR, they're saying that a lot of code
98+
has changed, and that you need to update your branch so it's easier to merge.
99+
100+
To learn more about rebasing in Git, there are a lot of
101+
[good](http://git-scm.com/book/en/Git-Branching-Rebasing)
102+
[resources](https://help.github.com/articles/interactive-rebase),
103+
but here's the suggested workflow:
104+
105+
```sh
106+
git checkout 123-fixing-nasty-issue
107+
git pull --rebase upstream master
108+
git push --force-with-lease 123-fixing-nasty-issue
109+
```
110+
111+
### 8. Merging a PR (maintainers only)
112+
113+
A PR can only be merged into master by a maintainer if:
114+
115+
* It is passing CI.
116+
* It has been approved by at least two maintainers. If it was a maintainer who
117+
opened the PR, only one extra approval is needed.
118+
* It has no requested changes.
119+
* It is up to date with current master.
120+
121+
Any maintainer is allowed to merge a PR if all of these conditions are
122+
met.
123+
124+
### 9. Shipping a release (maintainers only)
125+
126+
Maintainers need to do the following to push out a release:
127+
128+
* Make sure all pull requests are in
129+
* Create a stable branch for that release:
130+
131+
This example explains the process to tag a new version on `master`, where
132+
`upstream` references [dragonbe/hibp](https://github.com/dragonbe/hibp)and 2.0.8
133+
is our latest tag.
134+
135+
```sh
136+
git fetch upstream
137+
git checkout master
138+
git pull --rebase upstream master
139+
git tag -a 2.0.9
140+
git push upstream 2.0.9
141+
```
142+
143+
That's all there is to it.

0 commit comments

Comments
 (0)
Please sign in to comment.