'Post comment with custom CodeBuild build information to GitHub PR

A CodeBuild build gets triggered by a new commit in GitHub PR via webhook. The build uses a buildspec.yml file for steps it needs to run. Then it automatically posts a fail/success status back to the PR.

Is it possible to send a comment back to the PR after the build completes with some custom information, such as version, link to the version, link to the logs, etc?



Solution 1:[1]

I added the following to the shell script run from buildspec:

curl -s -H "Authorization: token ${TOKEN}" \
  -X POST -d "{\"body\": \"Sample Comment" \
  "https://api.github.com/repos/${OWNER}/${REPO}/issues/${PR_NUMBER}/comments"

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 yu?i