diff --git a/.tekton/linter.yaml b/.tekton/linter.yaml index 8701fcc51..9d8526e14 100644 --- a/.tekton/linter.yaml +++ b/.tekton/linter.yaml @@ -99,6 +99,17 @@ spec: image: registry.access.redhat.com/ubi9/python-312 workingDir: $(workspaces.source.path) script: | + set -x + if [[ "{{ headers['X-Github-Event'] }}" == "" ]]; then + echo "Not a GitHub event, skipping gitlint" + exit 0 + fi + + if [[ "{{ headers['X-Github-Event'] }}" != "pull_request" ]]; then + echo "Not a pull request, skipping gitlint" + exit 0 + fi + git config --global --add safe.directory $(workspaces.source.path) git log -1 --format=format:%s |grep -E -q '^Merge branch' && exit 0 pip3 install gitlint diff --git a/docs/content/docs/guide/authoringprs.md b/docs/content/docs/guide/authoringprs.md index 7b3fde6cf..3cfc6d23e 100644 --- a/docs/content/docs/guide/authoringprs.md +++ b/docs/content/docs/guide/authoringprs.md @@ -377,11 +377,11 @@ The expression are CEL expressions so you can as well make some conditional: if the PR is open the condition then return `true` and the shell script see this as a valid boolean. -Headers from the payload body can be accessed from the `headers` keyword, for -example +Headers from the payload body can be accessed from the `headers` keyword, note that headers are case sensitive, +for example this will show the GitHub event type for a GitHub event: ```yaml -{{ headers['x-github-event'] }} +{{ headers['X-Github-Event'] }} ``` and then you can do the same conditional or access as described above for the `body` keyword.