nerdexam
Microsoft

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)…

Author and Maintain Workflows

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)
  • B
    94% (31)
  • C
    3% (1)
  • D
    3% (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

#GitHub Actions#Contexts#Event Payloads#Workflow Triggers

Community Discussion

No community discussion yet for this question.

Full GH-200 Practice