Skip to content

Commit

Permalink
feat: Add toolkit version to terminal output and hidden content in PR…
Browse files Browse the repository at this point in the history
… comments
  • Loading branch information
FHeilmann committed Jan 4, 2024
1 parent 82c0bfb commit 0728b6a
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 6 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/bump_version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ jobs:
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
TOOLKIT_VERSION=${{ steps.tag_version.outputs.new_version }}
- name: Create a GitHub release
uses: ncipollo/release-action@v1
with:
Expand Down
7 changes: 4 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
FROM python:3.11.6-slim as builder
ARG TOOLKIT_VERSION

FROM python:3.11.6-slim as builder
WORKDIR /app

RUN apt-get update && apt-get install -y build-essential libadmesh-dev
Expand All @@ -14,7 +15,6 @@ COPY voron_toolkit/ /app/voron_toolkit
RUN poetry install --only-root && rm ./pyproject.toml ./poetry.lock

FROM python:3.11.6-slim as test

WORKDIR /app

RUN pip install poetry==1.7.0
Expand All @@ -24,7 +24,8 @@ RUN poetry install --only dev
RUN poetry run ruff voron_toolkit/ && poetry run ruff format --check voron_toolkit/ && poetry run mypy voron_toolkit

FROM python:3.11.6-slim as final

ARG TOOLKIT_VERSION
ENV VORON_TOOLKIT_VERSION=${TOOLKIT_VERSION}
WORKDIR /github/workspace
ADD https://github.com/unlimitedbacon/stl-thumb/releases/download/v0.5.0/stl-thumb_0.5.0_amd64.deb /tmp
RUN apt-get update && \
Expand Down
2 changes: 1 addition & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ echo -e "\033[1;91m #############"
echo -e "\033[1;91m #######"
echo -e "\033[1;91m #"
echo -e "\033[39m"
echo " Welcome to the VoronDesign Toolkit docker container!"
echo " Welcome to the VoronDesign Toolkit docker container (v${VORON_TOOLKIT_VERSION})!"
echo " If you encounter any issues, please report them to the VoronDesign team!"
echo ""

Expand Down
2 changes: 2 additions & 0 deletions voron_toolkit/constants.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import json
import os
from collections import defaultdict
from dataclasses import dataclass
from enum import Enum
Expand All @@ -9,6 +10,7 @@
CI_ERROR_LABEL: str = "Warning: CI Error"
READY_FOR_CI_LABEL: str = "Ready for CI"
PR_COMMENT_TAG: str = "<!-- voron_docker_toolkit -->"
PR_COMMENT_TOOLKIT_VERSION: str = f"<!-- Toolkit version {os.environ.get('VORON_TOOLKIT_VERSION', '<unknown>')} -->"
ALL_CI_LABELS: list[str] = [CI_PASSED_LABEL, CI_FAILURE_LABEL, CI_ERROR_LABEL, READY_FOR_CI_LABEL]


Expand Down
4 changes: 2 additions & 2 deletions voron_toolkit/utils/github_action_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from githubkit import GitHub, Response
from loguru import logger

from voron_toolkit.constants import PR_COMMENT_TAG, ExtendedResultEnum, ToolResult
from voron_toolkit.constants import PR_COMMENT_TAG, PR_COMMENT_TOOLKIT_VERSION, ExtendedResultEnum, ToolResult

STEP_SUMMARY_ENV_VAR = "GITHUB_STEP_SUMMARY"
OUTPUT_ENV_VAR = "GITHUB_OUTPUT"
Expand Down Expand Up @@ -178,7 +178,7 @@ def update_or_create_pr_comment(cls: type[Self], repo: str, pull_request_number:
comment_id = int(existing_comment["id"])
break

full_comment = f"{comment_body}\n\n{PR_COMMENT_TAG}\n"
full_comment = f"{comment_body}\n\n{PR_COMMENT_TAG}\n\n{PR_COMMENT_TOOLKIT_VERSION}"

if comment_id == -1:
# Create a new comment
Expand Down

0 comments on commit 0728b6a

Please sign in to comment.