GitHub Actions workflow triggered with files not stated in on.push.paths or on.pull_request.paths

Viewed 273
name: Console
on:
  push:
    paths:
      - "services/console/**"
      - ".github/workflows/console.yaml"
  pull_request:
    paths:
      - "services/console/**"
      - ".github/workflows/console.yaml"

We have the above in the following file: .github/workflows/console.yaml. We have other files in the source code, an example would be in services/example-service/**.

The problem I'm trying to fix or understand is the above workflow is triggered when files in the services/example-service are changed and pushed or is in a pull request. This shouldn't happen because that directory is not stated in the on push paths or on pull_request paths.

Here is the documentation for this: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#example-including-paths

Is there some scenario I've not thought of regarding this or would this be considered a bug?

The only thing I can see that it might be is this: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#git-diff-comparisons

Note: If you push more than 1,000 commits, or if GitHub does not generate the diff due to a timeout, the workflow will always run.

Our code has thousands of commits, but we do not push thousands of new commits when updating.

1 Answers

The reason was after contacting GitHub support was that pushes use two dot diffs while PRs use three dot diffs.

The two dot diff caused a trigger because we rebased the branch onto master which had changes to the directory stated and then we force pushed. This caused the diff between the new forced pushed branch and the immediate commit before on the branch to includes a hell of a lot of diffs, some of which were in the stated directroy.

Related