-
Notifications
You must be signed in to change notification settings - Fork 59.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix pull_request_target
if_merged example
#16752
Conversation
Within the workflow, the event object is still `github.event.pull_request`, so the `merged` key is at `github.event.pull_request.merged`. There _is not_ a `github.event.pull_request_target` object. This is also reflected in the table for this section in "Webhook event payload".
Thanks for opening this pull request! A GitHub docs team member should be by to give feedback soon. In the meantime, please check out the contributing guidelines. |
Automatically generated comment ℹ️This comment is automatically generated and will be overwritten every time changes are committed to this branch. The table contains an overview of files in the Content directory changesYou may find it useful to copy this table into the pull request summary. There you can edit it to share links to important articles or changes and to give a high-level overview of how the changes in your pull request support the overall goals of the pull request.
|
@kylelaker Thanks for opening a pull request! I've triaged this issue for technical review by a subject matter expert 👀 |
Thanks! If it helps, I created a sample repo with a |
Thanks @kylelaker - looks good to me! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM from a docs perspective!
Thanks for your contribution @kylelaker ✨
Thanks very much for contributing! Your pull request has been merged 🎉 You should see your changes appear on the site in approximately 24 hours. If you're looking for your next contribution, check out our help wanted issues ⚡ |
Within the workflow, the event object is still
github.event.pull_request
, so themerged
key is atgithub.event.pull_request.merged
. There is not agithub.event.pull_request_target
object. This is also reflected in the table for this section in "Webhook event payload".Why:
Copying and pasting the code sample provided to run on merged PRs will not work; the job will always be skipped because
github.event
does not have apull_request_target
key onpull_request_target
events. As documented in the "Webhook event payload" and as can be seen by dumping the event (${{ toJSON(github.event) }}
), the key ispull_request
instead.What's being changed:
The example code snippet is updated to:
which should work as-is for
pull_request_target
events to run a job on a merged PR.Check off the following:
Writer impact (This section is for GitHub staff members only):