Skip to content

Commit

Permalink
Added some more annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
ToreMerkely committed Sep 20, 2024
1 parent 29e23eb commit 4c5e0f8
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 2 deletions.
17 changes: 16 additions & 1 deletion .github/workflows/init_kosli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand All @@ -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}
15 changes: 14 additions & 1 deletion bin/never_alone/create_never_alone_trail.sh
Original file line number Diff line number Diff line change
Expand Up @@ -203,15 +203,24 @@ 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} \
--trail=${trail_name} \
--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} \
Expand All @@ -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
Expand Down

0 comments on commit 4c5e0f8

Please sign in to comment.