Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
This repository was archived by the owner on Jan 18, 2025. It is now read-only.

⚠️ OBSOLETE | A simple GitHub post-receive web hook handler able to trigger a CircleCI build.

License

Notifications You must be signed in to change notification settings

Slicer/github-circleci-trigger

Repository files navigation

Important

⚠️ This repository is obsolete as of January 2025. ⚠️

Previously, this repository was deployed on Heroku1 and configured as a webhook to trigger CircleCI builds for the Slicer/apidocs.slicer.org GitHub project whenever updates were made to the Slicer repository.

It has been superseded by the trigger-doxygen-build-and-publish.yml workflow, introduced in Slicer pull request #8144 and maintained within the Slicer repository. This new workflow triggers the doxygen-build-and-publish.yml workflow, which is maintained in the apidocs.slicer.org repository.


GitHub CircleCI Trigger

A simple GitHub post-receive web hook handler able to trigger a CircleCI build.

motivation

It is particularly useful for triggering CircleCI build using GitHub token.

quickstart

First, from a terminal, install and start the server

# create virtualenv
$ mkvirtualenv github-circleci-trigger

# choose CircleCI project to trigger
$ export CIRCLECI_REPO=orgname/worker-with-privileges (e.g Slicer/apidocs.slicer.org)
$ export CIRCLECI_TOKEN=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

# install server
$ git clone https://github.com/Slicer/github-circleci-trigger
$ pip install -r github-circleci-trigger/requirements.txt

# start server
$ cd github-circleci-trigger
$ export FLASK_APP="github-circleci-trigger.py"
$ export GITHUB_WEBHOOK_SECRET="This is a secret"
$ export FLASK_DEBUG="1"
$ python -m flask run
 * Serving Flask app "github-circleci-trigger"
 * Forcing debug mode on
 * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)

Then, open the URL http://127.0.0.1:5000 in your favorite browser. It should display Hello World! on the page and report the following in your terminal:

127.0.0.1 - - [25/Mar/2017 04:50:48] "GET / HTTP/1.1" 200 -

Now, let's install ngrok so that we can easily get a public URL and test.

The TOKEN is available at https://dashboard.ngrok.com/get-started/your-authtoken

$ unzip /path/to/ngrok-v3-stable-linux-amd64.tgz
$ ngrok config add-authtoken TOKEN
$ ngrok http 5000

[...]
Forwarding https://11ab-22-33-44-555.ngrok.io -> http://localhost:5000

Open again the *.ngrok.io URL in your browser and it should still display Hello World!.

Last, open the settings of orgname/open-source-project GitHub project and add a webhook:

  • Payload URL: https://11ab-22-33-44-555.ngrok.io/postreceive
  • Content type: application/json
  • Secret: This is a secret
  • Let me select individual events: Check Push and Pull Request

Et voila, each time a commit is pushed (or a pull request is created) on orgname/open-source-project our server will handle the GitHub webhook and trigger CircleCI build of orgname/worker-with-privileges project with the following parameters:

  • SLICER_REPO_NAME
  • SLICER_REPO_BRANCH
  • SLICER_REPO_TAG
  • SLICER_REPO_REVISION

thanks

This work was inspired from there projects:

license

It is covered by the Slicer License:

https://github.com/slicer-apidocs-builder/License.txt

Footnotes

  1. https://github-circleci-trigger.herokuapp.com/

About

⚠️ OBSOLETE | A simple GitHub post-receive web hook handler able to trigger a CircleCI build.

Topics

Resources

License

Stars

Watchers

Forks

Morty Proxy This is a proxified and sanitized view of the page, visit original site.