-
-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Sets up as a very basic GitHub Action
- Loading branch information
Showing
3 changed files
with
73 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
FROM php:8.2-cli-alpine | ||
|
||
RUN apk add --no-cache bash | ||
|
||
ADD cs2pr /usr/local/bin | ||
ADD action-entrypoint.sh /usr/local/bin | ||
|
||
ENTRYPOINT ["action-entrypoint.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
FLAGS=() | ||
|
||
[[ -n "$CS2PR_GRACEFUL_WARNINGS" ]] && FLAGS+=("--graceful-warnings") | ||
[[ -n "$CS2PR_COLORIZE" ]] && FLAGS+=("--colorize") | ||
[[ -n "$CS2PR_NOTICES_AS_WARNINGS" ]] && FLAGS+=("--notices-as-warnings") | ||
[[ -n "$CS2PR_ERRORS_AS_WARNINGS" ]] && FLAGS+=("--errors-as-warnings") | ||
[[ -n "$CS2PR_PREPEND_FILENAME" ]] && FLAGS+=("--prepend-filename") | ||
[[ -n "$CS2PR_PREPEND_SOURCE" ]] && FLAGS+=("--prepend-source") | ||
|
||
IFS=";" read -r -a FILES <<< "$CS2PR_FILES" | ||
|
||
cs2pr "${FLAGS[@]}" "${FILES[@]}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
name: cs2pr | ||
description: Convert checkstyle XML to GitHub PR annotations | ||
|
||
inputs: | ||
graceful-warnings: | ||
description: Don't exit with error codes if there are only warnings | ||
required: false | ||
default: "" | ||
colorize: | ||
description: Colorize the output (still compatible with Github Annotations) | ||
required: false | ||
default: "" | ||
notices-as-warnings: | ||
description: Convert notices to warnings (Github does not annotate notices otherwise) | ||
required: false | ||
default: "" | ||
errors-as-warnings: | ||
description: Downgrade errors to warnings | ||
required: false | ||
default: "" | ||
prepend-filename: | ||
description: Prepend error 'filename' attribute to the message | ||
required: false | ||
default: "" | ||
prepend-source: | ||
description: Prepend error 'source' attribute to the message | ||
required: false | ||
default: "" | ||
files: | ||
description: The checkstyle XML files to convert to GitHub PR annotations separated by semicolons | ||
required: true | ||
|
||
outputs: {} | ||
|
||
runs: | ||
using: docker | ||
image: Dockerfile | ||
env: | ||
CS2PR_GRACEFUL_WARNINGS: ${{ inputs.graceful-warnings }} | ||
CS2PR_COLORIZE: ${{ inputs.colorize }} | ||
CS2PR_NOTICES_AS_WARNINGS: ${{ inputs.notices-as-warnings }} | ||
CS2PR_ERRORS_AS_WARNINGS: ${{ inputs.errors-as-warnings }} | ||
CS2PR_PREPEND_FILENAME: ${{ inputs.prepend-filename }} | ||
CS2PR_PREPEND_SOURCE: ${{ inputs.prepend-source }} | ||
CS2PR_FILES: ${{ inputs.files }} | ||
|
||
branding: | ||
icon: "file" | ||
color: "purple" |