Search code examples
githubcontinuous-integrationgithub-actions

How to run GitHub Actions workflow only if a new file is pushed


Let's say that I have an action like such:

    name: Another_Action
    on:
      push:
        - ...
      pull_request:
        - ...

And I want it so that it only runs when a new file is committed.

I've got some options from the autocomplete:

Option Would help?
branches Nope
branches-ignore Nope
tags ???
tags-ignore ???
paths Maybe
paths-ignore Maybe
types ???

Using paths-ignore and listing all files and directories we already know of won't work since I want it automated and the directories won't stay the same forever.

I'm thinking of using paths for this since I already have used it in the past...

But I don't know how to use it in this context.


Solution

  • There is no such option. You can only abort the pipeline early by checking for new files after the checkout step has run