Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
aglipanci committed Jun 24, 2022
0 parents commit 94b4f43
Show file tree
Hide file tree
Showing 5 changed files with 89 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# ignore all files by default
*
# include required files with an exception
!entrypoint.sh
!README.md
8 changes: 8 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM composer:latest

RUN composer global require laravel/pint --no-progress --dev
ENV PATH="/tmp/vendor/bin:${PATH}"

COPY "entrypoint.sh" "/entrypoint.sh"
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# GitHub Action for Laravel Pint

GitHub Action implementation of the [Laravel Pint](https://github.com/laravel/pint) Package.

## Usage

Use with [GitHub Actions](https://github.com/features/actions)

_.github/workflows/pint.yml_

```
name: PHP Linting
on: pull_request
jobs:
phplint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: aglipanci/laravel-pint-action@main
```

If provided, a `pint.json` file in the root will be used for configuration during run of the Action.
30 changes: 30 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: 'Laravel Pint'
description: 'Laravel Pint is an opinionated PHP code style fixer for minimalists.'
author: 'Agli Panci <agli.panci@gmail.com>'
inputs:
testMode:
description: "would you like to run Pint on test mode"
required: false

verboseMode:
description: "would you like to run Pint on verbose mode"
required: false

configPath:
description: "specify the custom config path"
required: false

preset:
description: "pint preset"
required: false
runs:
using: 'docker'
image: 'Dockerfile'
args:
- ${{ inputs.test-mode }}
- ${{ inputs.verbose-mode }}
- ${{ inputs.config-path }}
- ${{ inputs.preset }}
branding:
icon: 'eye'
color: 'gray-dark'
24 changes: 24 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash
set -e

command_string=("pint")

if [[ "${INPUT_TESTMODE}" ]]; then
command_string+=" --test"
fi

if [[ "${INPUT_VERBOSEMODE}" ]]; then
command_string+=" -v"
fi

if [[ "${INPUT_CONFIGPATH}" ]]; then
command_string+=" --config ${INPUT_CONFIGPATH}"
fi

if [[ "${INPUT_PRESET}" ]]; then
command_string+=" --preset ${INPUT_PRESET}"
fi

echo "Running Command: " "${command_string[@]}"

${command_string[@]}

0 comments on commit 94b4f43

Please sign in to comment.