Skip to content
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

Comment failures to a separate issue #3361

Merged
merged 1 commit into from Oct 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 9 additions & 0 deletions .circleci/config.yml
Expand Up @@ -165,6 +165,14 @@ commands:
when: always
command: |
tools/circle-publish-github-comment.sh
publish_github_summary_comment:
steps:
- run:
name: Publish a summary comment to GitHub
when: on_fail
command: |
tools/circle-publish-github-summary-comment.sh

maybe_prepare_minio:
steps:
- run:
Expand Down Expand Up @@ -344,6 +352,7 @@ jobs:
tail -100 _build/mim2/rel/mongooseim/log/mongooseim.log.1
- upload_results_to_aws
- publish_github_comment
- publish_github_summary_comment

# #########################
# jobs in docker containers
Expand Down
35 changes: 35 additions & 0 deletions tools/circle-publish-github-summary-comment.sh
@@ -0,0 +1,35 @@
#!/usr/bin/env bash

if [[ ! -f /tmp/ct_summary ]] ; then
echo 'File "/tmp/ct_summary" is not there, aborting.'
exit
fi

if [ -z "$COMMENTER_GITHUB_TOKEN" ]; then
echo "\$COMMENTER_GITHUB_TOKEN is empty. Do nothing"
exit 0
fi

function make_body
{
echo "[Build]($CIRCLE_BUILD_URL) on $CIRCLE_BRANCH"
if [ ! -z "$CIRCLE_PULL_REQUEST" ]; then
echo "PR $CIRCLE_PULL_REQUEST"
fi
cat /tmp/ct_summary
}

REPO_SLUG="$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME"

function post_new_comment
{
POST_BODY=$(BODY_ENV="$BODY" jq -n '{body: env.BODY_ENV}')
curl -v -o /dev/null -i \
-H "Authorization: token $COMMENTER_GITHUB_TOKEN" \
-H "Content-Type: application/json" \
-X POST -d "$POST_BODY" \
https://api.github.com/repos/$REPO_SLUG/issues/3360/comments
}

BODY=$(make_body)
post_new_comment