Pytests temp files/folders fail on Github Actions (permission errors)

I have a python project which has tests written in pytest. All test pass on my local machine, while some of them fail when run via Github Actions.
One common thing to these failing test (not all of them, but most of) is a wierd permission error, which I am unable to reproduce locally and even test though test results are consistent, same actions sometimes work and sometimes don’t. Mostly it is related to pytest tmp_path and costom created files/folders.
Example:

>       with open(filePath, 'w+') as fHandler:
E       PermissionError: [Errno 13] Permission denied: '/tmp/pytest-of-runner/pytest-0/test_customBaseFolder0/root/package/subFolder/myModule.py'

In this specific case above, /tmp/pytest-of-runner/pytest-0/test_customBaseFolder0/root/package/subFolder is created in advance and is an existing folder.

The problem is, that the same thing (= creating subfolders and a file in a pytest tmp_path) work in some other scenario, for example, see file dlpt\tests\test_github.py which tests pass.

Any ideas what could be causing these permission errors?
An important note is that I am developing these tests on windows machine, while Github is executing tests on windows machine. However, this does not explain inconsistency described above.

Thanks.