'gh command line fetch the comment for a git commit by its hash

How to fetch the github comment associated with the commit hash on a project?

Lets say we have this github commit https://github.com/actions/checkout/commit/5126516654c75f76bca1de45dd82a3006d8890f9

How to fetch its comments using command line gh command? Github cli? https://github.com/cli/cli



Solution 1:[1]

I just tried the gh api approach, using the get commit API:

get /repos/{owner}/{repo}/commits/{ref}
gh api repos/actions/checkout/commits/5126516654c75f76bca1de45dd82a3006d8890f9 \
       --jq ".commit.message"

Result:

Bump minimist from 1.2.5 to 1.2.6 (#741)

Bumps [minimist](https://github.com/substack/minimist) from 1.2.5 to 1.2.6.
- [Release notes](https://github.com/substack/minimist/releases)
- [Commits](https://github.com/substack/minimist/compare/1.2.5...1.2.6)

---
updated-dependencies:
- dependency-name: minimist
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 VonC