Skip to content

Misleading guidance on workflow filters #32291

@DavidSlayback

Description

@DavidSlayback

Code of Conduct

What article on docs.github.com is affected?

Using Filters

What part(s) of the article would you like to see updated?

I didn't submit this as a PR because I don't know if the mistake is in Docs or in GitHub Actions.

In the docs, it states:

If you define both branches/branches-ignore and paths/paths-ignore, the workflow will only run when both filters are satisfied.

However, this is not true. Both in my own experience writing Actions for my company and in StackOverflow threads, it's clear that GitHub uses a logical OR instead of the implied AND from above. E.g., if I specify in a workflow:

on: 
  push:
    branches:
      - main
    paths:
      - "src/**"

I expect that the above should only trigger on a push to the main branch that alters files under src. However, it actually triggers on BOTH any push to main and any push to another branch that changes src files.

If this is the desired behavior, then the docs should be changed to reflect it. If it's not the desired behavior, then Actions should be changed to reflect the docs

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    SME reviewedAn SME has reviewed this issue/PRactionsThis issue or pull request should be reviewed by the docs actions teamcontentThis issue or pull request belongs to the Docs Content teammore-information-neededMore information is needed to complete reviewstaleThere is no recent activity on this issue or pull request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions