How do I detect if the current repo is a private repo?

From inside a GitHub workflow or third-party action, how can I tell if the repository running the action is a private repository?

I have a GitHub workflow that runs scripts in a package.json. Other people have wanted to copy the workflow and those scripts. One person has a private repository. They added the workflow and scripts to their repository and the scripts failed because it was a private repository.

I can fix it, but it would be a better fix if I could check whether the repository running the workflow is a public or private one. Is there a way that a workflow can tell if it’s running on a private repository?

I’m also trying to make this into a reusable action, so bonus points if it can be done from a GitHub third-party action too.

Edit: The stackoverflow question for it is at From inside a GitHub workflow, how can I tell if the repository running the action is a private repository? - Stack Overflow