Hi all! I hope you’re doing well.
I’m having trouble running some {gh} functions as part of a Github Action workflow. Specifically, I am unable to invite a collaborator to a repository, though I can perform other API actions. For example, the following request works locally, but not in a workflow. Here are the logs for a Github Action that successfully creates an issue using the {gh} package but fails when attempting to invite a collaborator. I must be missing something and would greatly appreciate any suggestions! The final workflow will be used in private and/or public repos for students to get feedback from their professor, though ideally it should work with repos in a Github organization context, too.
library(gh)
# Locally this works, but when I use it as Github Action, it does not.
gh::gh("PUT /repos/{owner}/{repo}/collaborators/{username}",
owner = "jdtrat",
repo = "actions",
username = "smasongarrison", #username included with permission (:
.token = Sys.getenv("GITHUB_PAT"))