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 1acfae3
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ jobs:
if: ${{ failure() }}
run: |
python ${LOG_TO_CS} ${RAW_LOG} ${CS_XML}
- name: Convert Raw Log to Checkstyle format
uses: mdeweerd/logToCheckStyle@v2024.1.1
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() }}
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 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"]
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: 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 }}']
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" = "" ] && /logToCs.py "$1" "$2" --root "$PWD"
[ "$3" != "" ] && /logToCs.py "$1" "$2" --root "$3"

0 comments on commit 1acfae3

Please sign in to comment.