Cross-platform intra-repo paths in workflow yaml


I’m not to GH Actions. I’m trying to unify a Windows-onlu with a Linux-only workflow, which do basically the same thing.

One of the challenges I’m coming up against is that GH actions seems to be forwarding file paths to the runner’s OS as-is, rather than adapting slash directions. Thus, if I want to use some file within my repo, named bar, in a directory dir - writing:

- name: My step
  run: foo\bar

will work on Windows, but fail on Linux, while

- name: My step
  run: foo/bar

will work on Linux and fail on Windows (I think).

What should I do to overcome this? I would rather not store all relevant file paths in my matrix…