GH-200 · Question #42
In a workflow triggered by a pull request comment, which GitHub Actions context property contains the event payload used to access the comment text and the pull request number?
The correct answer is B. github.event. When a workflow is triggered by a pull request comment (using the 'issue_comment' event), the full webhook event payload is accessible via (B) 'github.event'. This object contains all the data GitHub sends with the event, including the comment body (github.event.comment.body)…
Question
In a workflow triggered by a pull request comment, which GitHub Actions context property contains the event payload used to access the comment text and the pull request number?
Options
- Agithub.repository
- Bgithub.event
- Cgithub.event_path
- Dgithub.job
How the community answered
(33 responses)- B94% (31)
- C3% (1)
- D3% (1)
Explanation
When a workflow is triggered by a pull request comment (using the 'issue_comment' event), the full webhook event payload is accessible via (B) 'github.event'. This object contains all the data GitHub sends with the event, including the comment body (github.event.comment.body) and the pull request number (github.event.issue.number). (A) 'github.repository' contains the repository name in 'owner/repo' format, not event payload data. (C) 'github.event_path' is the filesystem path to a JSON file containing the event payload - useful for large payloads but not the direct property for accessing event data in expressions. (D) 'github.job' contains the job ID of the current job, not event data.
Topics
Community Discussion
No community discussion yet for this question.