The following snippet will update an issue or PR comment using a GraphQL mutation and curl.
Make sure you replace <REPLACE WITH YOUR GITHUB PERSONAL ACCESS TOKEN>
with an access token that has repo
scope on the repo in which the PR/issue appears.
Then replace the REPLACE WITH COMMENT NODE ID
with the node_id of your comment, e.g. MDEyOklzc3VlQ29tbWVudDc2NDc0NzcwOA==
.
Please note the ugly look of escaping quotes and backslashes.
curl -H "Authorization: bearer <REPLACE WITH YOUR GITHUB PERSONAL ACCESS TOKEN>" -X POST -d
"{
"query": "mutation {
updateIssueComment(input: {
id: \"REPLACE WITH COMMENT NODE ID\",
body: \"This is fantastic\"
}) {
issueComment {
lastEditedAt
}
}
}"
}
" https://api.github.com/graphql
This example query returns the issue's last edit time like so:
{"data":{"updateIssueComment":{"issueComment":{"lastEditedAt":"2021-01-21T23:45:53Z"}}}}
Make sure you read this documentation for the GraphQL mutation reference and for a manual on how to use the GraphQL endpoint manipulation:
https://docs.github.com/en/graphql/reference/mutations#updateissuecomment
https://docs.github.com/en/graphql/guides/forming-calls-with-graphql#communicating-with-graphql
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…