Experimenting with capturing GitHub Webhooks to trigger various activities in AWS
When a new Ping
event arrives the handler should:
- Create a new entry should be created in a DynamoDB table.
This allows someone to add the name of a source pipeline (Ideally an object added in the subjects Pipeline Terraform)
Note: Subject pipelines should be set to manual trigger - this handler will trigger the relevent pipeline automatically
- Read the record from DynamoDB and discover the source pipeline
- Generate a name for a cloned pipeline
- Clone the pipeline, modifying the source branch to ensure the new pipeline build this PR
- Read the record from DynamoDB and discover the source pipeline
- Generate a name for a cloned pipeline
- Delete the Clone the pipeline
The section details GitHub events and how the Lambda Function acts upon them
Sent when a webhook is added to a GitHub repository
Property | Comment |
---|---|
X-GitHub-Event |
ping |
respoitory.name |
Short Repository Name |
respoitory.full_name |
Full Respository Name |
hook.config.secret |
Webhook Secret |
hook.config.url |
Repository URL |
Sent when a commit is pushed to a repository
Property | Comment |
---|---|
X-GitHub-Event |
push |
ref |
Git Ref e.g. refs/heads/master |
pusher.name |
Committers Name |
pusher.email |
Committers Email Address |
head_commit.id |
Head commit for this push |
*created |
true on branch creation |
*deleted |
true on branch deletion |
*forced |
true on force push |
Sent when a new branch is created (paired with a push when a new branch is pushed)
Property | Comment |
---|---|
X-GitHub-Event |
create |
ref |
Git Short Ref e.g. master |
ref_type |
Type of Git Ref e.g. branch |
Sent when a pull request is opened
Property | Comment |
---|---|
X-GitHub-Event |
pull_request |
action |
open |
pull_request.title |
PR Title |
pull_request.head.ref |
Git Ref e.g. blp/webhook |
pull_request.head.repo.url |
repo url |
pull_request.head._links |
Links to the PR |
Sent when a comment is added to a PR
Property | Comment |
---|---|
X-GitHub-Event |
issue_comment |
action |
created |
Sent when a PR is modified (i.e. title edit)
Property | Comment |
---|---|
X-GitHub-Event |
pull_request |
action |
edited |
Other properties as per Pull Request Created
Sent when a PR is closed (either bu a user, or merged & closed)
Property | Comment |
---|---|
X-GitHub-Event |
pull_request |
action |
closed |
Note: a Merged PR will be followed by a push to the parent branch