From 4c5e0f8ab134a0cf59e8e618881c132a3c29c6bf Mon Sep 17 00:00:00 2001 From: Tore Martin Hagen Date: Fri, 20 Sep 2024 08:02:21 +0200 Subject: [PATCH] Added some more annotations --- .github/workflows/init_kosli.yml | 17 ++++++++++++++++- bin/never_alone/create_never_alone_trail.sh | 15 ++++++++++++++- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/.github/workflows/init_kosli.yml b/.github/workflows/init_kosli.yml index 67bc1cb7..77855bf1 100644 --- a/.github/workflows/init_kosli.yml +++ b/.github/workflows/init_kosli.yml @@ -90,8 +90,19 @@ jobs: PR_URL=$(cat ${USER_DATA_FILENAME} | jq -r '.pullRequest.url // empty') if [ -n "$PR_URL" ]; then PR_ANNOTATE_ARG="--annotate pull_request=$PR_URL" + + commit_author_name=$(cat ${USER_DATA_FILENAME} | jq -r '.commit.author.name') + review_decision=$(echo "${latest_never_alone_data}" | jq -r '.pullRequest.reviewDecision') + reviewers=$(echo "${latest_never_alone_data}" | jq -r '.pullRequest.reviews[0].author.name') + COMMITER_ANNOTATE_ARG="--annotate commit_author_name=${commit_author_name}" + REVIEW_DECISION_ANNOTATE_ARG="--annotate review_decision=${review_decision}" + REVIEWERS_ANNOTATE_ARG="--annotate reviewers=${reviewers}" + else PR_ANNOTATE_ARG="" + COMMITER_ANNOTATE_ARG="" + REVIEW_DECISION_ANNOTATE_ARG="" + REVIEWERS_ANNOTATE_ARG="" fi kosli attest generic \ @@ -101,4 +112,8 @@ jobs: --name=never-alone-data \ --compliant=true \ --user-data="${USER_DATA_FILENAME}" \ - ${PR_ANNOTATE_ARG} + ${PR_ANNOTATE_ARG} \ + ${COMMITER_ANNOTATE_ARG} \ + ${REVIEW_DECISION_ANNOTATE_ARG} \ + ${REVIEWERS_ANNOTATE_ARG} + diff --git a/bin/never_alone/create_never_alone_trail.sh b/bin/never_alone/create_never_alone_trail.sh index bcaaeded..8cb5285e 100755 --- a/bin/never_alone/create_never_alone_trail.sh +++ b/bin/never_alone/create_never_alone_trail.sh @@ -203,7 +203,12 @@ function attest_commit_trail_never_alone if [ "${never_alone_data}" != "[]" ]; then latest_never_alone_data=$(echo "${never_alone_data}" | jq '.[-1]') url_to_source_attestation=$(echo $latest_never_alone_data | jq -r '.html_url') + commit_author_name=$(echo "${latest_never_alone_data}" | jq -r '.user_data.commit.author.name') + review_decision=$(echo "${latest_never_alone_data}" | jq -r '.user_data.pullRequest.reviewDecision') + pr_url=$(echo "${latest_never_alone_data}" | jq -r '.user_data.pullRequest.url') + reviewers=$(echo "${latest_never_alone_data}" | jq -r '.user_data.pullRequest.reviews[0].author.name') set_never_alone_compliance "${latest_never_alone_data}" + if [ "${COMPLIANT_STATUS}" == "true" ]; then kosli attest generic \ --flow=${flow_name} \ @@ -211,7 +216,11 @@ function attest_commit_trail_never_alone --name="${commit_sha}" \ --commit=${commit_sha} \ --compliant="true" \ - --annotate="never_alone_data=${url_to_source_attestation}" + --annotate="never_alone_data=${url_to_source_attestation}" \ + --annotate="commit_author_name=${commit_author_name}" \ + --annotate="review_decision=${review_decision}" \ + --annotate="pull_request=${pr_url}" \ + --annotate="reviewers=${reviewers}" else kosli attest generic \ --flow=${flow_name} \ @@ -220,6 +229,10 @@ function attest_commit_trail_never_alone --commit=${commit_sha} \ --compliant="false" \ --annotate="never_alone_data=${url_to_source_attestation}" \ + --annotate="commit_author_name=${commit_author_name}" \ + --annotate="review_decision=${review_decision}" \ + --annotate="pull_request=${pr_url}" \ + --annotate="reviewers=${reviewers}" \ --annotate="reason_for_non_compliance=${REASON_FOR_NON_COMPLIANT}" fi fi