diff --git a/USERS.md b/USERS.md index caa94c3d41..1d6c980dfa 100644 --- a/USERS.md +++ b/USERS.md @@ -17,3 +17,4 @@ Organizations below are **officially** using Argo Events. Please send a PR with 1. [RTL Nederland](https://www.rtl.nl) 1. [Viaduct](https://www.viaduct.ai/) 1. [Woolworths Group](https://www.woolworthsgroup.com.au/) +1. [7shifts](https://www.7shifts.com) diff --git a/examples/sensors/github.yaml b/examples/sensors/github.yaml index 373b65f072..174f54a7d4 100644 --- a/examples/sensors/github.yaml +++ b/examples/sensors/github.yaml @@ -9,6 +9,29 @@ spec: - name: test-dep eventSourceName: github eventName: example + filters: + data: + # Name of the event that triggered the delivery: [pull_request, push, yadayadayada] + # https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads + - path: body.X-GitHub-Event + type: string + value: + - pull_request + - path: body.action + type: string + value: + - opened + - edited + - reopened + - synchronize + - path: body.pull_request.state + type: string + value: + - open + - path: body.pull_request.base.ref + type: string + value: + - master triggers: - template: name: github-workflow-trigger @@ -22,26 +45,43 @@ spec: apiVersion: argoproj.io/v1alpha1 kind: Workflow metadata: - generateName: github- + name: github- spec: entrypoint: whalesay arguments: parameters: - - name: message - # value will get overridden by the event payload - value: hello world + - name: pr-title + - name: pr-number + - name: short-sha templates: - - name: whalesay - inputs: - parameters: - - name: message - container: - image: docker/whalesay:latest - command: [cowsay] - args: ["{{inputs.parameters.message}}"] + - name: whalesay + inputs: + parameters: + - name: pr-title + - name: pr-number + - name: short-sha + container: + image: docker/whalesay:latest + command: [cowsay] + args: ["{{inputs.parameters.pr-title}}"] parameters: - src: dependencyName: test-dep + dataKey: body.pull_request.title dest: spec.arguments.parameters.0.value + - src: + dependencyName: test-dep + dataKey: body.pull_request.number + dest: spec.arguments.parameters.1.value + - src: + dependencyName: test-dep + dataTemplate: "{{ .Input.body.pull_request.head.sha | substr 0 7 }}" + dest: spec.arguments.parameters.2.value + # Append pull request number and short sha to dynamically assign worklfow name + - src: + dependencyName: test-dep + dataTemplate: "{{ .Input.body.pull_request.number }}-{{ .Input.body.pull_request.head.sha | substr 0 7 }}" + dest: metadata.name + operation: append retryStrategy: steps: 3