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

Add cel filter for pull request actions in github example #637

Merged
merged 1 commit into from Jun 26, 2020

Conversation

ljupchokotev
Copy link
Contributor

Changes

The GitHub interceptor doesn't filter the actions for the pull_request event type, which means it will trigger when editing a pull requests' description and other similar actions.

This commit adds a CEL interceptor in order to filter the pull request actions and only trigger when a pull request is opened, synchronized, or reopened.

Submitter Checklist

These are the criteria that every PR should meet, please check them off as you
review them:

See the contribution guide for more details.

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Jun 25, 2020

CLA Check
The committers are authorized under a signed CLA.

@tekton-robot tekton-robot added size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jun 25, 2020
@tekton-robot
Copy link

Hi @ljupchokotev. Thanks for your PR.

I'm waiting for a tektoncd member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@savitaashture
Copy link
Contributor

/ok-to-test

@tekton-robot tekton-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jun 25, 2020
@ljupchokotev
Copy link
Contributor Author

@savitaashture not sure if I need to do something about the failed check?

@savitaashture
Copy link
Contributor

savitaashture commented Jun 25, 2020

@savitaashture not sure if I need to do something about the failed check?

@ljupchokotev could you please run ./hack/update-docs.sh and update your PR

@tekton-robot tekton-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Jun 25, 2020
@ljupchokotev
Copy link
Contributor Author

@savitaashture done

@@ -14,6 +14,11 @@ spec:
secretKey: secretToken
eventTypes:
- pull_request
- cel:
filter: >-
body.action == 'opened' ||
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should be able to do body.action in ['opened', 'synchronize','reopened']

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cleaner, thanks!

The GitHub interceptor doesn't filter the actions for the `pull_request` event type, which means it will trigger when editing a pull requests' description and other similar actions.

This commit adds a CEL interceptor in order to filter the pull request actions and only trigger when a pull request is opened, synchronized, or reopened.
@tekton-robot tekton-robot added size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Jun 25, 2020
@dibyom
Copy link
Member

dibyom commented Jun 26, 2020

Excellent, thank you @ljupchokotev !!!

/kind documentation
/approve
/lgtm

@tekton-robot tekton-robot added kind/documentation Categorizes issue or PR as related to documentation. lgtm Indicates that a PR is ready to be merged. labels Jun 26, 2020
@tekton-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dibyom

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@tekton-robot tekton-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 26, 2020
@tekton-robot tekton-robot merged commit fa3a902 into tektoncd:master Jun 26, 2020
@ljupchokotev ljupchokotev deleted the github-example branch June 26, 2020 16:20
dibyom added a commit to dibyom/triggers that referenced this pull request Jul 6, 2020
Needed for tektoncd#637 and fixes tektoncd#627

Signed-off-by: Dibyo Mukherjee <dibyo@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. kind/documentation Categorizes issue or PR as related to documentation. lgtm Indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants