I need to create an aws codepipeline webhook to github using terraform that will filter the events coming from github to only events that are from a specific branch and prefix of files that are added, modified or deleted that are listed as strings in the $.head_commit path.
I have the filter on the branch working setting the json_path to $.ref and the match="refs/head/development" however I'm not clear what the syntax would be for matching on the string values in the added, modified and deleted lists would be. I've tried a couple of examples that are listed on the Json-Path but so far I haven't been able to generate a matchEquals value that works.
Essentially I'm trying to get a version of this filter to work where mypath is what I'm trying to find an existence of inside the payload of the push event:
"filters": [
{
"jsonPath": "$.head_commit.modified",
"matchEquals": "^.*mypath.*$"
},
{
"jsonPath": "$.ref",
"matchEquals": "refs/heads/development"
}
]
Here is an abridged version of the payload sent by github
{
"ref": "refs/heads/development",
"head_commit": {
"message": "Update README.md",
"timestamp": "2019-06-26T10:03:38-07:00",
"added": [
],
"removed": [
],
"modified": [
"packages/mypath/README.md"
]
}
}
Update 6/27/2019 After opening a support ticket it turns out that currently AWS doesn't support regex in the matchEquals property. There is no eta on when it might be added but there is already an existing feature request in to support it.
Off to plan c "Restart the core somehow!"