From 06a029aca2aca80f1d6fc495acb594c9b2d44e13 Mon Sep 17 00:00:00 2001 From: Chmouel Boudjnah Date: Tue, 24 Oct 2023 12:18:56 +0200 Subject: [PATCH] Convert docs variables list to markdown table Since it does look better and easier to sort, there is an issue with width on example but i think people can just select the table and it will be fine. Import the docs-dev makefile target as well to open the web browser when doing make docs-dev Signed-off-by: Chmouel Boudjnah --- Makefile | 4 +++- docs/content/docs/guide/authoringprs.md | 30 +++++++++++++------------ 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/Makefile b/Makefile index 07c210869..9fda19c4a 100644 --- a/Makefile +++ b/Makefile @@ -116,7 +116,9 @@ html-coverage: ## generate html coverage .PHONY: docs-dev docs-dev: ## preview live your docs with hugo - @hugo server -s docs/ + @hugo server -s docs/ & \ + if type -p xdg-open; then xdg-open http://localhost:1313; elif type -p open; then open http://localhost:1313; fi ;\ + fg check-generated: # vendor update-golden @git status -uno |grep -E "modified:[ ]*(vendor/|.*.golden$)" && \ diff --git a/docs/content/docs/guide/authoringprs.md b/docs/content/docs/guide/authoringprs.md index b8a7954f3..ae6df93b4 100644 --- a/docs/content/docs/guide/authoringprs.md +++ b/docs/content/docs/guide/authoringprs.md @@ -29,20 +29,22 @@ weight: 3 allows you to have those "dynamic" variables expanded. Those variables look like this `{{ var }}` and those are the one you can use: - - `{{body}}`: The full payload body available directly or as a CEL expression (see [below](#using-the-body-and-headers-in-a-pipelines-as-code-parameter)) - - `{{headers}}`: The payload request headers available directly or as a CEL expression (see [below](#using-the-body-and-headers-in-a-pipelines-as-code-parameter)). - - `{{event_type}}`: The event type (eg: `pull_request` or `push`). - - `{{git_auth_secret}}`: The secret name auto generated with provider token to check out private repos. - - `{{pull_request_number}}`: The pull or merge request number, only defined when we are in a `pull_request` event type. - - `{{repo_name}}`: The repository name. - - `{{repo_owner}}`: The repository owner. - - `{{repo_url}}`: The repository full URL. - - `{{revision}}`: The commit full sha revision. - - `{{sender}}`: The sender username (or accountid on some providers) of the commit. - - `{{source_branch}}`: The branch name where the event come from. - - `{{source_url}}`: The source repository URL from which the event come from (same as `repo_url` for push events). - - `{{target_branch}}`: The branch name on which the event targets (same as `source_branch` for push events). - - `{{target_namespace}}`: The target namespace where the Repository has matched and the PipelineRun will be created. +| Variable | Description | Example | Example Output | +|---------------------|---------------------------------------------------------------------------------------------------|-------------------------------------|------------------------------| +| body | The full payload body (see [below](#using-the-body-and-headers-in-a-pipelines-as-code-parameter)) | `{{body.pull_request.user.email }}` | | +| headers | The request headers (see [below](#using-the-body-and-headers-in-a-pipelines-as-code-parameter)) | `{{headers['x-github-event']}}` | push | +| event_type | The event type (eg: `pull_request` or `push`) | `{{event_type}}` | pull_request | +| git_auth_secret | The secret name auto generated with provider token to check out private repos. | `{{git_auth_secret}}` | pac-gitauth-xkxkx | +| pull_request_number | The pull or merge request number, only defined when we are in a `pull_request` event type. | `{{pull_request_number}}` | 1 | +| repo_name | The repository name. | `{{repo_name}}` | pipelines-as-code | +| repo_owner | The repository owner. | `{{repo_owner}}` | openshift-pipelines | +| repo_url | The repository full URL. | `{{repo_url}}` | https:/github.com/repo/owner | +| revision | The commit full sha revision. | `{{revision}}` | 1234567890abcdef | +| sender | The sender username (or accountid on some providers) of the commit. | `{{sender}}` | johndoe | +| source_branch | The branch name where the event come from. | `{{source_branch}}` | main | +| source_url | The source repository URL from which the event come from (same as `repo_url` for push events). | `{{source_url}}` | https:/github.com/repo/owner | +| target_branch | The branch name on which the event targets (same as `source_branch` for push events). | `{{target_branch}}` | main | +| target_namespace | The target namespace where the Repository has matched and the PipelineRun will be created. | `{{target_namespace}}` | my-namespace | - For Pipelines-as-Code to process your `PipelineRun`, you must have either an embedded `PipelineSpec` or a separate `Pipeline` object that references a YAML