-
Imagine I have the repository From the environment variables I successfully utilize Is there a way to get the owner of a PR without relying on the actor that triggered the workflow? |
Beta Was this translation helpful? Give feedback.
Replies: 6 comments
-
You can use the expression (github.event.pull_request.head.repo.owner.login) to get the owner of the head repository from the github context.
Of course, if you feel that this expression is too long, you can map it as a environment variable with a shorter name.
About the default environment variables automatically set by GitHub, most of them (start with the prefix ‘GITHUB_’) have the corresponding properties in the github context. You can print the github context to view more information about the current workflow run and the event that triggered the run.
|
Beta Was this translation helpful? Give feedback.
-
Thanks for the tip. I didn’t know about the |
Beta Was this translation helpful? Give feedback.
-
When the workflow is not triggered by the events that related to the PR, if you want to get the information of the PR in this workflow, you can execute the “Get a pull request” API in the workflow, and extract the information you need from the response of the API. |
Beta Was this translation helpful? Give feedback.
-
How are things going? Please try it. Any update, feel free to tell me. Thanks. |
Beta Was this translation helpful? Give feedback.
-
Hey @brightran, thanks for checking in. Something else came up and I have to handle this first. From what I understand from skimming the links you posted, this is exactly what I need. I’ll just accept your answer as solution for now and ping you if it somehow does not work as I intended it. Thanks again for your support :slight_smile: |
Beta Was this translation helpful? Give feedback.
-
You’re welcome. |
Beta Was this translation helpful? Give feedback.
@pmeier,
You can use the expression (github.event.pull_request.head.repo.owner.login) to get the owner of the head repository from the github context.
Of course, if you feel that this expression is too long, you can map it as a environment variable with a shorter name.
About the default environmen…