Opening a Pull Request
When you start out with a jam we ask your team leader to fork the code jam brief repository to their account for your to work on your code.
In this guide we're going to go over:
- Forking the repository
- Opening a pull request back to the code jam brief on python-discord
- Adding collaborators
- Adding a GitHub webhook to your teams Discord channel
Forking the repository
When you browse to the code jam brief repository you will be presented with the project root.
You want to fork the repository to your account using the button shown in the image below:
If you see a dialog like this one, just select your user.
Once you've done this you'll be redirected to a page like this:
And that's it! You've forked the repo!
Opening a Pull Request
Before we can open a Pull Request you need to have something to actually compare against the brief repo.
In the actual jam you should fill in the Project information section of the README.md, but for now I'm just going to add a line to the README.
Once you've made your commit, navigate back to the project root where you will see this button above your commit bar:
You should click on this pull request button. When you do you will see something like this, just click the Create pull request button:
Next up you'll see a form like this:
You should fill it in like so:
That's it! You've opened your pull request and should see something like this:
Adding collaborators
Obviously your fork is no good if your team members cannot make edits to it. To allow your team mates to edit you need to add them to the project as collaborators.
We're going to start off by heading to our fork of the repository (this is the one with your username in it, not python-discord) and head to the settings page.
Click on collaborators. GitHub will ask you to enter your password now for security. Enter it and proceed.
You should see a page like this:
Add your team members using this form and use the copy invite button to copy an invite link they can then use. You should send this to them in your team channel on Discord.
Once your team mates have joined you'll see this:
That's all! Your teammates have access to the repository now!
Add a GitHub webhook to Discord
It may be useful to keep up on your GitHub repository updates right from your Discord channel. For that reason, we've assigned all team leaders webhook creation permissions inside your team channel.
Webhook creation
To make use of this we're going to start out by making a webhook inside the channel.
To do this go to your team channel and click on the gear that appears when you mouse-over it.
Navigate to the Webhooks section of the settings page and click Create Webhook
.
You'll see something like this:
You can edit the name to 'GitHub' or anything, but GitHub will do this anyway.
Copy the link to the clipboard, you will get something like this:
https://canary.discordapp.com/api/webhooks/548221675087462410/h7lkQ7cX5-95J8CLMNCGXTEBrWOmXYFWv7N4MqsFtV-D8F0W8Rf3rWj4dPAEFGspm7EZ
By default this is not configured to respond to GitHub payloads so you will need to add a /github
to the end of the URL.
Your new URL should look like:
https://canary.discordapp.com/api/webhooks/548221675087462410/h7lkQ7cX5-95J8CLMNCGXTEBrWOmXYFWv7N4MqsFtV-D8F0W8Rf3rWj4dPAEFGspm7EZ/github
Adding to GitHub
Next up we will head over to our GitHub project settings (on our fork) and go to the webhooks section:
Click on the Add Webhook button and paste in your URL to the Payload URL
section.
Set the Content Type
to application/json
otherwise Discord cannot interpret your request.
You can select either just the push or everything depending on how much information you want.
Make sure Active
is ticked and click Add webhook
.
And that's it! You've added a Discord webhook to your GitHub repository!
As you can see here, my teammate has commited a change to our fork:
In our Discord channel, you can see the following: