We welcome pull requests from anyone in the world. Follow these steps to contribute:
-
Find an issue that needs assistance by searching for the Help Wanted tag.
-
Let us know you are working on it by posting a comment on the issue.
-
Follow the Contribution Guidelines to start working on the issue.
Remember to feel free to ask for help in our Sovereign Gitter room.
If you've found a bug that is not on the board, follow these steps.
- Prerequisites
- Forking The Project
- Create A Branch
- Setup Linting
- Setup Sovereign
- Make Changes
- Run The Test Suite
- Squash Your Commits
- Creating A Pull Request
- Common Steps
- How We Review and Merge Pull Requests
- How We Close Stale Issues
- Next Steps
- Other resources
On Linux & MacOS, load a terminal and type:
$ curl https://install.meteor.com/ | sh
This will setup Meteor (including Node and Mongo if necessary).
Note: Windows users must download installer.
- Install Git or your favorite Git client.
- (Optional) Setup an SSH Key for GitHub.
- Create a parent projects directory on your system. For this guide, it will be assumed that it is
/mean/
- Go to the top level Sovereign repository: https://github.com/DemocracyEarth/sovereign
- Click the "Fork" Button in the upper right hand corner of the interface (More Details Here)
- After the repository has been forked, you will be taken to your copy of the sovereign repo at
yourUsername/sovereign
- Open a Terminal / Command Line / Bash Shell in your projects directory (i.e.:
/yourprojectdirectory/
) - Clone your fork of sovereign
$ git clone https://github.com/yourUsername/sovereign.git
This will download the entire sovereign repo to your projects directory.
- Change directory to the new sovereign directory (
cd sovereign
) - Add a remote to the official sovereign repo:
$ git remote add upstream https://github.com/DemocracyEarth/sovereign.git
Congratulations, you now have a local copy of the sovereign repo!
Now that you have a copy of your fork, there is work you will need to do to keep it current.
Do this prior to every time you create a branch for a PR:
- Make sure you are on the
staging
branch
$ git status On branch staging Your branch is up-to-date with 'origin/staging'.
If your aren't on
staging
, resolve outstanding files / commits and checkout thestaging
branch
$ git checkout staging
- Do A Pull with Rebase Against
upstream
$ git pull --rebase upstream staging
This will pull down all of the changes to the official staging branch, without making an additional commit in your local repo.
- (Optional) Force push your updated staging branch to your GitHub fork
$ git push origin staging --force
This will overwrite the staging branch of your fork.
Before you start working, you will need to create a separate branch specific to the issue / feature / project you're working on. You will push your work to this branch.
Name the branch something like fix-#-desc
where #
is the issue number and desc
is a short description of the issue that you are attempting to fix, no more than 20 chars.
If you are working base on project topics, Name the branch something like feat-#-desc
, impr-#-desc
, prj-#-desc
where #
is the issue number and desc
is a short description of the issue that you are attempting to fix, no more than 20 chars.
For example feat-5-edit-proposals
would be a branch where I will add a feature to edit proposals.
To create a branch on your local machine (and switch to this branch):
$ git checkout -b [name_of_your_new_branch]
and to push to GitHub:
$ git push origin [name_of_your_new_branch]
If you need more help with branching, take a look at this.
You should have ESLint running in your editor, and install all the dependencies with meteor npm install
in sovereign folder.
It will highlight anything doesn't conform to Airbnb styleguide.
For more information, read the meteor style guide that also includes a link to ESlint.
Please do not ignore any linting errors, as they are meant to help you and to ensure a clean and simple code base.
Once you have Sovereign cloned, before you start the application, you need to install all of the dependencies:
# Install NPM dependencies
meteor npm install
# Run the program
meteor npm run start:dev
Now navigate to your browser and open http://localhost:3000. If the app loads, congratulations β you're all set. Otherwise, let us know by asking in the Sovereign Room on Gitter. There also might be an error in the console of your browser or in Bash / Terminal / Command Line that will help identify the problem.
This bit is up to you!
When your are ready to share your code, run the test suite:
$ meteor npm run test
$ meteor npm run test-app
and ensure all tests pass.
When you make a pull request, all of your changes need to be in one commit.
If you have made more then one commit, then you will need to squash your commits.
To do this, see Squashing Your Commits.
A pull request (PR) is a method of submitting proposed changes to the Sovereign Repo (or any Repo, for that matter). You will make changes to copies of the files which make up Sovereign in a personal fork, then apply to have them accepted by Sovereign proper.
Sovereign Issue Mods and staff are on hand to assist with Pull Request related issues on our Chat Room.
The best way to find out any code you wish to change/add or remove is using the GitHub search bar at the top of the repository page. For example, you could search for a challenge name and the results will display all the files along with line numbers. Then you can proceed to the files and verify this is the area that you were looking forward to edit. Always feel free to reach out to the chat room when you are not certain of any thing specific in the code.
Take away only one thing from this document, it should be this: Never, EVER
make edits to the staging
branch. ALWAYS make a new branch BEFORE you edit
files. This is critical, because if your PR is not accepted, your copy of
staging will be forever sullied and the only way to fix it is to delete your
fork and re-fork.
There are two methods of creating a pull request for Sovereign:
- Editing files via the GitHub Interface
- Editing files on a local clone
This is the recommended method. Read about How to Setup and Maintain a Local Instance of Sovereign.
- Perform the maintenance step of rebasing
staging
. - Ensure you are on the
staging
branch usinggit status
:
$ git status
On branch staging
Your branch is up-to-date with 'origin/staging'.
nothing to commit, working directory clean
-
If you are not on staging or your working directory is not clean, resolve any outstanding files/commits and checkout staging
git checkout staging
-
Create a branch off of
staging
with git:git checkout -B branch/name-here
Note: Branch naming is important. Use a name likefix-#-short-fix-description
orfeat-#-short-feature-description
. Review the Contribution Guidelines for more detail. -
Edit your file(s) locally with the editor of your choice
-
Check your
git status
to see unstaged files. -
Add your edited files:
git add path/to/filename.ext
You can also do:git add .
to add all unstaged files. Take care, though, because you can accidentally add files you don't want added. Review yourgit status
first. -
Commit your edits:
git commit -m "Brief Description of Commit"
-
Squash your commits, if there are more than one.
-
Push your commits to your GitHub Fork:
git push -u origin branch/name-here
-
Go to Common Steps
Note: Editing via the GitHub Interface is not recommended, since it is not possible to update your fork via GitHub's interface without deleting and recreating your fork.
Read the Wiki article for further information
-
Once the edits have been committed, you will be prompted to create a pull request on your fork's GitHub Page.
-
By default, all pull requests should be against the Sovereign main repo,
staging
branch. -
Submit a pull request from your branch to Sovereign's
staging
branch. -
The title (also called the subject) of your PR should be descriptive of your changes and succinctly indicates what is being fixed.
-
Do not add the issue number in the PR title.
-
Examples:
Add Test Cases to Bonfire Drop It
Correct typo in Waypoint Size Your Images
-
-
In the body of your PR include a more detailed summary of the changes you made and why.
- If the PR is meant to fix an existing bug/issue, then, at the end of
your PR's description, append the keyword
closes
and #xxxx (where xxxx is the issue number). Example:closes #1337
. This tells GitHub to close the existing issue, if the PR is merged.
- If the PR is meant to fix an existing bug/issue, then, at the end of
your PR's description, append the keyword
-
Indicate if you have tested on a local copy of the site or not.
Sovereign has a team of volunteer Issue Moderators. These Issue Moderators routinely go through open pull requests in a process called Quality Assurance (QA).
-
If an Issue Moderator QA's a pull request and confirms that the new code does what it is supposed without seeming to introduce any new bugs, they will comment "LGTM" which means "Looks good to me."
-
Another Issue Moderator will QA the same pull request. Once they have also confirmed that the new code does what it is supposed to without seeming to introduce any new bugs, they will merge the pull request.
If you would like to apply to join our Issue Moderator team - which is a Core Team position - message @LucasIsasmendi with links to 5 of your pull requests that have been accepted and 5 issues where you have helped someone else through commenting or QA'ing.
We will close any issues or pull requests that have been inactive for more than 30 days, except those that match the following criteria:
- bugs that are confirmed
- pull requests that are waiting on other pull requests to be merged
- features that are a part of a GitHub project
Once your PR is accepted, you may delete the branch you created to submit it. This keeps your working fork clean.
You can do this with a press of a button on the GitHub PR interface. You can
delete the local copy of the branch with: git branch -D branch/to-delete-name
Don't despair! You should receive solid feedback from the Issue Moderators as to why it was rejected and what changes are needed.
Many Pull Requests, especially first Pull Requests, require correction or updating. If you have used the GitHub interface to create your PR, you will need to close your PR, create a new branch, and re-submit.
If you have a local copy of the repo, you can make the requested changes and
amend your commit with: git commit --amend
This will update your existing
commit. When you push it to your fork you will need to do a force push to
overwrite your old commit: git push --force
Be sure to post in the PR conversation that you have made the requested changes.