Skip to content

on.pull_request.paths-ignore are not respected correctly #2324

Open
@GRBurst

Description

@GRBurst

Describe the bug

According to the documentation we can use paths-ignore in the same way for pull_request events as we can do for push events on.<push|pull_request|pull_request_target>.<paths|paths-ignore>.

However, if we define a workflow like the following, the behavior differs:

name: Echo Date

on:
  push:
    paths-ignore:
      - 'README.md'
  pull_request:
    types: [opened, synchronize]
    paths-ignore:
      - 'README.md'

jobs:
  echo-date:
    runs-on: ubuntu-latest
    name: "Echo"

    steps:
      - name: Run echo date
        run: |
          echo -e "Hello at $(date -I)"

Although it seems to be working at the beginning when I (1) created a pr, (2) pushed a change on README.md and (3) nothing triggered, the behavior changed as soon as one commit of the pr references a file outside of the paths-ignore list.
After a change to a file outside of the paths-ignore list, all following commits trigger the workflow.

Someone else mentioned a problem here as well: #545 (comment)

To Reproduce
You can find a minimal example here: https://github.com/GRBurst/pull_requests.paths

Steps to reproduce the behavior:

  1. Create an action as above (or fork the example)
  2. Create a new branch and a pr
  3. Add commits, where at least one commit changes a file outside the paths-ignore declaration
  4. Check that all following commits trigger the workflow (the pull_request events triggers, the push does not).

Expected behavior
I expect that the conditions to run the actions only take the last commit into account.
So if I have commit that changes a file outside the path definition, it triggers the workflow.
If a following commit does only changes to files declared in the paths-ignore list, the workflow should not trigger.

Runner Version and Platform

Version of your runner?
-> 2.299.1

OS of the machine running the runner? OSX/Windows/Linux/...
-> Ubuntu, 22.04.1, LTS

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions