Skip to content

Commit

Permalink
docs: Enriched github example (#1204)
Browse files Browse the repository at this point in the history
* enriched github example

Signed-off-by: Caue Santos <[email protected]>
  • Loading branch information
caueasantos authored May 7, 2021
1 parent 97cee45 commit cea92bb
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 12 deletions.
1 change: 1 addition & 0 deletions USERS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
64 changes: 52 additions & 12 deletions examples/sensors/github.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 <github-21500-2c065a>
- 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

0 comments on commit cea92bb

Please sign in to comment.