diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index 033bab2..b6d569d 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -34,6 +34,10 @@ jobs: if: ${{ failure() }} run: | python ${LOG_TO_CS} ${RAW_LOG} ${CS_XML} + - name: Convert Raw Log to Checkstyle format + if: ${{ failure() }} + in: ${{ env.RAW_LOG }} + out: ${{ env.CS_XML }} - name: Annotate Source Code with Messages uses: staabm/annotate-pull-request-from-checkstyle-action@v1 if: ${{ failure() }} diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..e69d8ba --- /dev/null +++ b/Dockerfile @@ -0,0 +1,10 @@ +# Container running the action +FROM python:3.11-slim-bookworm + +RUN pip install expr +# Copy entry point +COPY entrypoint.sh /entrypoint.sh +COPY logToCs.py /logToCs.py + +# Code file to execute when the docker container starts up (`entrypoint.sh`) +ENTRYPOINT ["/entrypoint.sh"] diff --git a/action.yml b/action.yml new file mode 100644 index 0000000..91fc47d --- /dev/null +++ b/action.yml @@ -0,0 +1,23 @@ +--- action.yml +... +--- +name: logToCheckStyle +description: Greet someone and record the time +inputs: + in: + description: Source log path + required: true + out: + description: Target path + required: true + root: + description: Prefix to remove from paths in log + required: false + default: +# outputs: +# outpath: # id of output +# description: The the output path +runs: + using: docker + image: Dockerfile + args: ['${{ inputs.in }}', '${{ inputs.out }}', '${{ inputs.root }}'] diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100755 index 0000000..2da66fb --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,3 @@ +#!/bin/bash -l +[ "$3" = "" ] && /logToCs.py "$1" "$2" --root "$PWD" +[ "$3" != "" ] && /logToCs.py "$1" "$2" --root "$3"