Preview adding a Lock Reason via the Lock Issue API
When locking an issue via the issues API, you can now provide an optional reason that will be visible to anyone who views the issue. Valid lock reasons are "off-topic", "too heated", "resolved", and "spam". Providing a lock reason can help make it clearer to contributors why an issue was locked, and what kinds of behavior may result in issues being locked in the future. This change will be available on both the REST API as well as the GraphQL API.
To set a lock_reason
during the preview period, you must provide a custom media type in the Accept header:
application/vnd.github.sailor-v-preview+json
During the preview period, we may change aspects of these API methods based on developer feedback. If we do, we will announce the changes here on the developer blog, but we will not provide any advance notice.
To our GitHub Enterprise customers: issue lock reasons will be available in the next Enterprise release (2.13), but not in the current version or older versions.
REST API changes
-
Issue and pull request responses now contain an
active_lock_reason
field that shows thelock_reason
that was selected for an issue or pull request, if it is currently locked and a reason was provided. - You can use the REST API to pass an optional
lock_reason
parameter to the Lock issue atPUT /repos/:owner/:repo/issues/:number/lock
. -
Issue and pull request event responses now contain a
lock_reason
field that shows thelock_reason
that was selected for alocked
event.
GraphQL API changes
-
Lockable
objects now contain anactiveLockReason
field that shows thelock_reason
that was selected for an issue or pull request, if it is currently locked and a reason was provided. - You can now lock issues and pull requests through the GraphQL API through the
lockLockable
mutation, which includes an optionallockReason
parameter.
If you have any questions or feedback, please let us know!