mirror of
https://github.com/chromebrew/chromebrew.git
synced 2026-01-05 05:34:10 -05:00
3.8 KiB
3.8 KiB
Contributing
Are you wondering how you can get started? You can learn how from this free series How to Contribute to an Open Source Project on GitHub.
Prerequisites
- A GitHub project in which you have access
- A text editor or IDE (integrated development environment)
- Basic knowledge of the command line in a terminal session
gitSSH key
How to submit a Pull Request (aka PR)
- Click the Fork button in the top right to copy the repo to your own GitHub project.
- Open a terminal and clone your forked project locally:
$ git clone git@github.com:your-project-name/chromebrew.git && cd chromebrew
- Create a branch for your PR:
$ git checkout -b update-cool-package
- Add, edit or delete the file(s) you would like to change and save.
- Test your changes! See steps 7 through 11 in the
How to test a pending PR from another contributorsection below. - Stage your changes:
$ git add -A
- Review your changes:
$ git diff --staged
- Correct your changes and repeat steps 4 through 7, if necessary.
- Commit your changes:
$ git commit -m "Add some awesome change to cool package"
- Push your changes:
$ git push origin update-cool-package
- Visit your project page in the browser:
https://github.com/your-project-name/chromebrew - Click the New pull request button next to the Branch: selector drop-down.
- Select your branch name from the compare: selector drop-down on the right.
- Scroll down and review your changes.
- Click the Create pull request button.
- Add a short description of your change.
- Click the Create pull request button.
How to test a pending PR from another contributor
- Open the PR of interest.
- Next to the green Open badge, you should see something similar to:
contributor-name wants to merge 1 commit into chromebrew:master from contributor-name:update-cool-package
- On the far right, take note of contributor-name:update-cool-package. This is the PR contributor along with the branch they want to merge.
- Open a terminal, change to your cloned chromebrew directory and execute:
$ git remote add contributor-name git@github.com:contributor-name/chromebrew.git
- Fetch their branches:
$ git fetch contributor-name
- Checkout their branch:
$ git checkout update-cool-package
- If the requested change is a package:
$ cp packages/cool_package.rb /usr/local/lib/crew/packages/
- Test the new or updated package:
$ crew upgrade cool_package
- Examine the files to see if everything installed as expected:
$ crew files cool_package
- Run some tests on executables, if applicable:
$ cool_package --version
$ cool_package --help
$ cool_package --some-other-option
- To see if this package is a dependency for another package, execute:
$ grep "depends_on 'cool_package'" packages/*.rb
and, just in case:
$ grep 'depends_on "cool_package"' packages/*.rb
If the package is a dependency for another package, test commands of the other package, if possible, to see if they were affected in any way.
- Visit the PR and add a comment suggesting any changes or mark it RTBC if everything looks good.
Learn more
- Visit the wiki
Pre-commit hooks.
Chromebrew has pre-commit hooks to catch errors before they make it to CI.
To install them, run pre-commit install in the root of the repository.
You will first need to install the pre-commit tool, which can be done via crew install py3_pre_commit on ChromeOS.