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 repo to when block #642

Merged
merged 3 commits into from
Dec 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions docs/docs/20-usage/22-conditional-execution.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,20 @@ Woodpecker supports defining conditional pipeline steps in the `when` block. If

This can also be utilised on a playbook level if you have multi-arch agents and require specific pipelines to be run on specific architectures. See [platform](#platform) below.

## `repo`

Example conditional execution by repository:

```diff
pipeline:
slack:
image: plugins/slack
settings:
channel: dev
+ when:
+ repo: test/test
```

## `branch`

Example conditional execution by branch:
Expand Down
7 changes: 7 additions & 0 deletions pipeline/schema/.woodpecker/test-when.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,3 +88,10 @@ pipeline:
include: [ '.woodpecker/*.yml', '*.ini' ]
exclude: [ '*.md', 'docs/**' ]
ignore_message: "[ALL]"

when-repo:
image: alpine
commands:
- echo "test"
when:
repo: test/test
13 changes: 13 additions & 0 deletions pipeline/schema/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,19 @@
"type": "object",
"additionalProperties": false,
"properties": {
"repo": {
"description": "Execute a step only on a specific repository. Read more: https://woodpecker-ci.org/docs/usage/conditional-execution#repo",
"oneOf": [
{
"type": "array",
"items": {
"type": "string"
},
"minLength": 1
},
{ "type": "string" }
]
},
"branch": {
"description": "TODO Read more: https://woodpecker-ci.org/docs/usage/pipeline-syntax#branch",
"type": "string"
Expand Down