vsoch / pull-request-action

open a pull request when a branch is pushed or updated

Home Page:https://github.com/marketplace/actions/pull-request-action

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TypeError: expected str, bytes or os.PathLike object, not NoneType

yanhong-tech opened this issue · comments

While using “/pull-request-action@master” actions. The action created the pull request but threw an error made a steps red. The error shows;

File “/pull-request.py”, line 83, in set_env_and_output
with open(environment_file_path, “a”) as environment_file:

TypeError: expected str, bytes or os.PathLike object, not NoneType.

GitHub env and the actions passed env are all string. Can you help check this error showed up? Thanks!

It sounds like the environment_file_path is set to None, so one of these two is set to None:

for env_var in ("GITHUB_ENV", "GITHUB_OUTPUT"):
environment_file_path = os.environ.get(env_var)
print("Writing %s=%s to %s" % (name, value, env_var))
with open(environment_file_path, "a") as environment_file:
environment_file.write("%s=%s\n" % (name, value))

Can you tell me if you can see which variable it's choking on? Or if those envars have changed? Likely if one is unset we can just check for None (and not set it there) but it GitHub actions has changed that variable we need to do more updates.

Try testing with this branch - let me know which is reported unset #102

I cannot see which one got choking on.
I think we only made pull @master, but let me try. Thanks for checking!

If you try the PR branch I linked it should print the one that is None. Thank you!

when I use my personal repo, this action all works. I need get the access for the repo(only sync master) I had error to pull your branch to test. will let you know! Thank you.

You shouldn't need to pull my branch - just change the URI of the action in your workflow file, instead of @master do @test-envar-files and it will use the branch.

steps:
      - name: pull-request-action
        uses: vsoch/pull-request-action@test-envar-files

yes that's how I did the test, it works on my own repo, but enterprise repo i am working on we have the middle network control that i can not pull @test-envar-files test branch.

Sorry not sure I can help with advice for how to test enterprise. Maybe use a free account?

Hi vsoch, sorry get back a little bit late. Finally this test can go though by using @test-envar-files branch.
The job is green from your change, and it has the warning that Warning: GITHUB_OUTPUT is unset, skipping.
Let me know if you plan to merge your conditions or I can set this variable. Thanks

@yanhong-tech thanks for the update! I think that's probably OK - that sounds like it might be a change or depend on the environment. Let's merge and release to master.

All set and merged / releases, version 1.1.1. Thanks!

Thanks @vsoch.