Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Event payload modification using CEL #330

Closed
dibyom opened this issue Jan 9, 2020 · 2 comments
Closed

Event payload modification using CEL #330

dibyom opened this issue Jan 9, 2020 · 2 comments
Assignees
Labels
kind/feature Categorizes issue or PR as related to a new feature.
Milestone

Comments

@dibyom
Copy link
Member

dibyom commented Jan 9, 2020

From @bigkevmcd in #49 (comment)

Now that CEL interceptor is in there, I'd like to see if we can't agree on how to do CEL munging, i.e. the original values implementation in early days of that branch.

triggers:
- name: cel-trig
interceptor:
cel:
filter: "headers.match('X-GitHub-Event', 'pull_request')"
values:
"pr.url": body.pull_request.url
"pr.short_sha": truncate(body.head.sha, 7)
I'd propose something similar, I don't have a better name than values, but I think it should be a list of key/values, with "key" and "expression" as the keys for each thing to update.

so...

triggers:

  • name: cel-trig
    interceptor:
    cel:
    filter: "headers.match('X-GitHub-Event', 'pull_request')"
    values:
    - key: pr.url
    expression: body.pull_request.url
    - key: pr.short_sha
    expression: truncate(body.head.sha, 7)
    This would be used in the same way as the original values implementation, i.e. if the filter was successful, using sjson to set the keys in the body to the values returned by the expressions.

This allows an interceptor to add custom keys to the body, or, modify existing ones if it wants to.

@dibyom dibyom added the kind/feature Categorizes issue or PR as related to a new feature. label Jan 9, 2020
@dibyom dibyom added this to the Triggers 0.3 milestone Jan 21, 2020
@dibyom
Copy link
Member Author

dibyom commented Jan 21, 2020

#329

@wlynch
Copy link
Member

wlynch commented Feb 11, 2020

Done!

@wlynch wlynch closed this as completed Feb 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Categorizes issue or PR as related to a new feature.
Projects
None yet
Development

No branches or pull requests

3 participants