Skip to content

Commit

Permalink
Create github action
Browse files Browse the repository at this point in the history
  • Loading branch information
mdeweerd committed Jan 16, 2024
1 parent 2e08350 commit a833766
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 2 deletions.
11 changes: 9 additions & 2 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,17 @@ jobs:
set -o pipefail
pre-commit gc
pre-commit run --show-diff-on-failure --color=always --all-files | tee ${RAW_LOG}
- name: Convert Raw Log to CheckStyle format
if: ${{ failure() }}
- name: Convert Raw Log to CheckStyle format (launch script)
# if: ${{ failure() }}
if: false
run: |
python ${LOG_TO_CS} ${RAW_LOG} ${CS_XML}
- name: Convert Raw Log to Checkstyle format (launch action)
uses: mdeweerd/logToCheckStyle@v2024.1.5
if: ${{ failure() }}
with:
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() }}
Expand Down
10 changes: 10 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Container running the action
FROM python:3.11-slim-bookworm

RUN pip install regex
# 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"]
23 changes: 23 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
# action.yml
#
name: logToCheckStyle
description: Convert text log to CheckStyle xml format
inputs:
in:
description: Source log path (Textual input log)
required: true
out:
description: Target log path (CheckStyle xml format log)
required: true
root:
description: Prefix to remove from paths in log
required: false
default:
# outputs:
# outpath: # id of output
# description: The output path
runs:
using: docker
image: Dockerfile
args: ['${{ inputs.in }}', '${{ inputs.out }}', '${{ inputs.root }}']
3 changes: 3 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash -l
[ "$3" = "" ] && python /logToCs.py "$1" "$2" --root "$PWD" && exit 0
[ "$3" != "" ] && python /logToCs.py "$1" "$2" --root "$3" && exit 0

0 comments on commit a833766

Please sign in to comment.