woodpecker: Linter should not report warning for missing when in steps if global when is set

Component

server

Describe the bug

Currently even if global when is set warning for each step is still shown

[bad_habit] Please set an event filter on all when branches

System Info

{"source":"https://github.com/woodpecker-ci/woodpecker","version":"next-65d88be523"}

Additional context

No response

Validations

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 16 (16 by maintainers)

Most upvoted comments

Where’s the “global” (I assume workflow-level) event filter in your example?

yeah exactly it is configured at workflow level, not step level

Yeah, thank you it works! I badly understood, I thought -branch: '*' was the event and I did think about the event property. Thank you a lot!

Where’s the “global” (I assume workflow-level) event filter in your example?

This when just filters for branch or path. You must do something like this:

 when:
  - branch: '*'
+   event: push
  - path:
     include:
       - ".woodpecker/spa-build-image.yaml"
       - "spa/**"
     ignore_message: "[REFRESH]"
+   event: [push, pull_request]

Ahhh okay my bad, I see that event needs to be first, and no indent. That wasn’t super clear in the docs, the difference between AND and OR.

There are two when branches:

  1. status: [ failure ]
  2. event: pull_request

They’re connected with OR, so the first one doesn’t have an event filter. Every when branch should have an event filter.

It’s not required, but it’s highly recommended as we might add new events in the feature and you probably don’t want to run a lint step if e.g. a new issue is opened.

The ui only shows a warning with the bad_habit category, not an error.

yes, sorry, works correctly, had typo