paths-ignore option causes empty (amend) commits to be ignored

I just realized this, and I am not sure if this is a bug or intented behavior.

When we have a normal workflow, an empty commit, created with

git commit --allow-empty -m "Empty commit"

will cause the workflow, which just specifies “on: push” to run. But when we add an “paths-ignore” option to the workflow like this

on:
  push:
    paths-ignore:
      - 'doc/**'

empty commits are suddenly not invoking the workflow anymore.

Also, and I think this is related to this,  empty amend commits , which I create and then force-push on a clean working copy with

git commit --amend --no-edit
git push -f

will not create a workflow run anymore for this commit, even when the original commit has changes which should not be ignored, which results in commits, that contain a change that should trigger a workflow, but does not have a workflow run. Without the paths-ignore option in the workflow, the empty amend commit always retriggers a workflow run.

Sometimes we need to rerun a workflow for the given (last) commit, and I used to do it on my personal feature branch (where only I work on) by the empty ammend commit, but this does not work anymore after we are ignoring paths now for the workflow. Any hints on how to solve this?

@stummi ,

Thanks for your feedback.

I can reproduce the same problem as you report. The paths filter ( paths or paths-ignore ) seems prevents the workflow run from being triggered, when pushing an empty commit.

I have reported this question to the appropriate engineering team for further investigation and evaluation. If they have any progress, I will notify you in time, and sometimes the appropriate engineers may directly reply you here.

2 Likes

I also use this feature for intricate workflows (repository_dispatch). Any news on this?

I was disappointed by GitHub’s native “paths-ignore”. Therefore, I published this Action that implements an improved “paths-ignore” : https://github.com/fkirc/skip-duplicate-actions

You may give it a try if GitHub’s “path-ignore” isn’t good enough, especially for “required checks”.