Skip to content

Latest commit

 

History

History
73 lines (59 loc) · 2.81 KB

contributing.md

File metadata and controls

73 lines (59 loc) · 2.81 KB

Contributing code samples or demo apps

If you would like to contribute a demo that you have built or a sample code that you have identified as missing for an API module documentation on MediaWiki.org, first create an issue in this repository.

If the repo contributors or maintainers agree that the proposed sample code or demo app would be a useful addition to this repository, go ahead and start working on the issue. Send a pull request when you have your changes ready to be accepted or merged!

Follow the instructions below to create a pull request:

Fork this repository by clicking "Fork" at the top-right on GitHub.

$ git clone https://github.com/USERNAME/mediawiki-api-demos.git
Clone your fork to your local machine

$ git remote add upstream https://github.com/wikimedia/mediawiki-api-demos.git
Keep track of changes in the original repository by adding 'upstream' to the
list of remotes

$ git pull upstream master
Fetch the latest changes from upstream's master and merge them with your
repository's master branch

$ git checkout -b BRANCHNAME
Create a new branch (BRANCHNAME) and check it out.

$ git add filename
$ git commit -m "your commit message"
Make and commit your changes

$ git pull --rebase upstream master
Rebase your changes against upstream's master

$ git push origin BRANCHNAME
Push your changes and create a pull request
Learn more: https://help.github.com/en/articles/creating-a-pull-request

If there are new changes in the upstream and a merge conflict occurs in your pull request, you may resolve merge conflicts on GitHub or through the command line. To resolve merge conflicts on GitHub, see https://help.github.com/en/articles/resolving-a-merge-conflict-on-github. The process to resolve merge conflicts through the command line is as follows:

$ git checkout master

$ git pull upstream master
Fetch the latest changes from upstream's master and merge them with your
repository's master branch

$ git checkout BRANCHNAME

$ git merge master
Merge the changes from master onto your branch

If there are merge conflicts, an error containing the list of affected files will be thrown. The message in the affected files will be as follows:

<<<<<<< HEAD
Change in your branch
=======
Change in master
>>>>>>> master

Resolve the conflict by manually editing the file to keep the changes you want then:

$ git add affectedfile

$ git commit -m 'Resolve merge conflict'
Commit the merge

$ git push origin BRANCHNAME
Learn more: https://help.github.com/en/articles/resolving-a-merge-conflict-using-the-command-line

For GET requests modules only, python, javascript and php sample code can be auto-generated by following the instructions below:

$ cd mediawiki-api-demos
Add module information to `modules.json`
$ python autogenerator.py
Make desired changes to the newly generated file(s) if necessary