Tests pass on github, fail locally

If I executing:

using PkgHelpers, Pkg
Pkg.test("PkgHelpers")

this fails with:

freeze: Error During Test at /home/ufechner/.julia/packages/PkgHelpers/UHq7F/test/runtests.jl:28
  Got exception outside of a @test
  SystemError: opening file "/tmp/test-1.toml": Permission denied
  Stacktrace:
    [1] systemerror(p::String, errno::Int32; extrainfo::Nothing)
      @ Base ./error.jl:176
    [2] systemerror
      @ Base ./error.jl:175 [inlined]

The code that fails is:

    mydir = tempdir()
    filename = "test-1.toml"
    filename2 = "test-2.toml"
    mytoml = joinpath(mydir, filename)
    cp(filename, mytoml, force=true)

Or probably this one:

  open(project_file, "w") do io

Why do I get a permission denied error if I try to write to a file in the tmp directory locally, but not on github?

(Using Ubuntu 22.04)

Ok I could solve the issue by changing the code to:

mydir = tempdir()
filename = "test-1.toml"
filename2 = "test-2.toml"
mytoml = joinpath(mydir, filename)
cp(filename, mytoml, force=true)
chmod(mytoml, 0o777)

The issue was, in a local package all files are read only. I copy a test file to the tmp directory and try to overwrite it there. This only works if I make it writable first.