When github.actor is a member, not github.repo_owner #27160
-
I encountered the following use case. Certain actions in a workflow should activate, only when the actor is the owner. This condition is created in order to disable certain actions on a PR from a forked/feature to upstream/master, but be enabled in any other push or PR case:
There is the possibility of a member of an organization to be the actor, which would mean that the above condition will return false, because the owner is the organization. However, if the actor in this case is a member, the desired outcome is for the condition to return true, since a member of an organization logically (in the context of the condition) is owner. Is there a way to check if the actor is a member ? - something like:
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
The solution I came up with is this: Write a script that would compare github.actor against each member’s login name in an organization, taken from a request like this https://api.github.com/orgs/github/members and store the outcome in an output of that step, so it can be used in the original condition like this:
The script should look something like this:
|
Beta Was this translation helpful? Give feedback.
The solution I came up with is this:
Write a script that would compare github.actor against each member’s login name in an organization, taken from a request like this https://api.github.com/orgs/github/members and store the outcome in an output of that step, so it can be used in the original condition like this:
The script should look something like this: