Collaborate With GitHub Pull Requests

It’s now time to collaborate with other learners taking this class around the world :earth_americas:.

  1. In the class repository on GitHub.com, navigate to the Pull Requests tab.
  2. Look through other pull requests. Do they look like good changes, with CI passing? Feel free to post an encouraging message!
  3. In your own pull request, wait to see if the branch passes the Travis CI tests and is ready to merge.
Help me troubleshoot

Help: My Build Failed

The class repository is using continuous integration through Travis CI to run tests on the code you have entered. To put it simply, it is checking to make sure the syntax is correct in your file.

The files we are using are very picky. If you made any mistakes, you will see a message that your build has failed. This usually means that the text you entered is incorrect. Check the syntax carefully against the instructions and edit your file as needed.

When you commit your changes, Travis CI will re-check your file.

Keep doing this until you see a message that the build has passed. If you need help, don’t forget you can @ mention @githubteacher in your pull request.

Help With Specific Issues

The build can fail because of many reasons. By looking at the details of the Travis CI log it might help you to troubleshoot your code.

  1. Open the Pull request
  2. Go to the bottom to the “merge” icon to the section where it says ‘checks have failed’.
    Here you’ll see a lot of red ‘x’s :x:. Not good.
  3. Open the Details

The build log of Travis CI may appear a little cryptic. But with some careful reading you might be able to pull out the reason why your build is failing. (By the way, if you think the job log is cryptic, try and click on the Raw log.)

The build script is a series of commands. It might be helpful to know that every new command starts with a $ sign. Such commands can be something simple or a new (sub)script. The individual properties of your branch are tested in individual scripts. For example, Travis CI very early on tests whether your file is formatted as an appropriate “.yaml file”.


404 error

Somewhere down the cascade of tests Travis CI will check if the URL following pageUrl actually exists. The test and the complete build will fail if a website does not exist (a “404 error”).

It is possible you might have mistyped your URL or something went wrong when you tried to publish your website. It is also possible that users who previously merged their branch with the master have sadly deleted their repository and their website disappeared.

Try and discover in the log which URL is causing a 404 error. You can double check whether the website exist by copying it into your browser.

Because you are working in your own branch it is safe to change the code however you like. If you see something that can be fixed easily you could just edit the offending file. For instance you can replace the broken URL with something that does exist (e.g. github.com). A more rigorous solution would be to delete the file altogether.

Once your fix is correct and the build is no longer failing, you are ready to merge your branch with the master. You might get some merge conflicts you will need to address first. Ask @githubteacher if you get stuck.


Help: Something is Wrong

This is a busy repository with a lot of contributors. If you see a different message, check the troubleshooting guide below:

Message What to do?
This branch has conflicts and cannot be merged This message is telling you that someone has made a change to master that conflicts with the changes you made in your file. We don’t cover merge conflicts in this class so @ mention githubteacher from your Pull Request and we will help you get it resolved!
Tell me why

Reviewing the GitHub Flow

  1. :white_check_mark: Create a branch
  2. :white_check_mark: Add commits
  3. :white_check_mark: Open a Pull Request
  4. Collaborate, and make more commits :arrow_left: (This section deals with this step.)
  5. Merge the Pull Request

Understanding Continuous Integration

Our class repository uses continuous integration (CI) to ensure that the files being added conform to certain guidelines. For example, our tests are checking to ensure you have formatted the file correctly and placed it in the correct directory within the repository.

If the tests do not pass on your Pull Request, you will be unable to merge until you have fixed the problem. For help, see the Help me troubleshoot section above.

Stuck? Open an issue in the repository for this class and mention @githubteacher for help from one of the GitHub trainers!
Continue