-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
458a7ae
commit f08e03b
Showing
4 changed files
with
93 additions
and
2 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,12 @@ | ||
FROM php:7.4-cli | ||
|
||
RUN apt-get update && apt-get -y install zip unzip | ||
|
||
RUN curl -sS https://getcomposer.org/installer | php -- \ | ||
--install-dir=/usr/bin --filename=composer && chmod +x /usr/bin/composer | ||
|
||
RUN mkdir /twigcs && cd /twigcs && composer require friendsoftwig/twigcs && ln -s /twigcs/vendor/bin/twigcs /usr/local/bin/twigcs | ||
|
||
COPY "entrypoint.sh" "/entrypoint.sh" | ||
RUN chmod +x /entrypoint.sh | ||
ENTRYPOINT ["/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 |
---|---|---|
@@ -1,2 +1,35 @@ | ||
# actions-twigcs | ||
TwigCS Action for GitHub Actions | ||
# GitHub Action for TwigCS | ||
GitHub Action implementation of the TwigCS Package provided by [https://github.com/friendsoftwig/twigcs](@friendsoftwig/twigcs). | ||
|
||
## Inputs | ||
|
||
### `dir` | ||
|
||
The folder to run twigcs recursively from. | ||
|
||
Default `'.'`. | ||
|
||
### `severity_tolerance` | ||
|
||
The exit code of TwigCS is based on the severity of any violation found. By default, twigcs only tolerates notices, this input changes this. | ||
|
||
Available options: | ||
`error` - Allows notices and warnings | ||
`notice` - Disallows notices | ||
`ignore` - Allows everything | ||
|
||
Default `notice`. | ||
|
||
### `ignore_folder` | ||
|
||
Optional: Name of a subfolder to exclude. | ||
|
||
## Example usage | ||
|
||
``` | ||
uses: DirtDiglett/actions-twigcs@v1 | ||
with: | ||
dir: ./src/views | ||
severity_tolerance: notice | ||
ignore_folder: vendor | ||
``` |
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,27 @@ | ||
name: 'Twigcs' | ||
description: 'A GitHub Action that runs Twigcs on a repository.' | ||
author: 'DirtDiglett' | ||
|
||
branding: | ||
icon: 'eye' | ||
color: 'orange' | ||
|
||
inputs: | ||
dir: | ||
description: 'Folder to check code style' | ||
required: false | ||
default: . | ||
severity_tolerance: | ||
description: 'What level of exit code should be tolerated' | ||
required: false | ||
ignore_folder: | ||
description: 'Ignore subfolders that match name' | ||
required: false | ||
|
||
runs: | ||
using: 'docker' | ||
image: 'Dockerfile' | ||
args: | ||
- ${{ inputs.dir }} | ||
- ${{ inputs.severity_tolerance }} | ||
- ${{ inputs.ignore_folder }} |
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,19 @@ | ||
#!/bin/bash -l | ||
set -e | ||
|
||
PHP_FULL_VERSION=$(php -r 'echo phpversion();') | ||
|
||
echo "======================" | ||
echo "= Running TwigCS =" | ||
echo "======================" | ||
echo "PHP Version : ${PHP_FULL_VERSION}" | ||
|
||
if [[ -n "$INPUT_SEVERITY_TOLERANCE" ]]; then | ||
options+=(-c "$INPUT_SEVERITY_TOLERANCE") | ||
fi | ||
|
||
if [[ -n "$INPUT_IGNORE_FOLDER" ]]; then | ||
options+=(-c "$INPUT_IGNORE_FOLDER") | ||
fi | ||
|
||
twigcs $INPUT_DIR "${options[@]}" |