Requires Python 2.7
GitHub-YouTrack web hook is designed for updating YouTrack issues by push event. Based on Bloomberg's webhook.
The hook constantly listens all local interfaces to receive push events from GitHub. Once the hook recieves a push event, it parses the event payload. The hook does two things:
- Publishes comments to corresponding issues groupping by the author with revision and branch information.
- Automatically updates "Fix versions" and "Commited to" fields.
During posting the comment the webhook compares the email of GitHub committer with YouTrack user's email. As well as marking issues, the comment publishing performs by user found by email from commit. If email not found, the event performs from the system user. It is advised to provide developer grants to all the committers. The webhook does not publish duplicated comments.
Go to your GitHub project settings
https://github.com/<github_account>/<project>/settings/hooks
and find new webhook created by previous step. Edit the hook parameters:
Payload URL should be as example:
http://IP_ADDRESS:PORT/postreceive
Content type:
application/json
Secret
Generate any secret key (token, passphrase etc)
Pick "Just the push event" for events you would like to trigger this webhook.
Mark the hook is active.
Install Python 2.7
Download and install
git clone https://github.com/bloomberg/python-github-webhook
sudo apt install python-pip
pip install -U pip setuptools
sudo python setup.py install
Download the webhook
https://git.haulmont.com/platform/github-youtrack-hook
Download the directory
https://github.com/JetBrains/youtrack-rest-python-library/tree/master/python
and place it to the webhook folder as api folder.
Copy config_template.py to config.py
Replace all default fields <REQUIRED> to your settings.
Use token/passphrase generated previously.
Start python webhook (grants required for port 80):
sudo python github_youtrack_hook.py
It should work on address (defaults can be changed)
http://IP_ADDRESS:PORT
Send a push event, wait for a while until the process finishes. You should see some new comments in issues which were mentioned in commits pushed. Check a log file or console window for details.
For the test purposes you can reuse payloads sending them from Recent Deliveries on Webhooks Setting page.