Code Monkey home page Code Monkey logo

laravel-pint-action's Introduction

GitHub Action for Laravel Pint

GitHub Action implementation of the Laravel Pint Package.

Usage

Use with GitHub Actions

_.github/workflows/pint.yml

name: PHP Linting
on: pull_request
jobs:
  phplint:
    runs-on: ubuntu-latest
    steps:
        - uses: actions/checkout@v4
        - name: "laravel-pint"
          uses: aglipanci/laravel-pint-action@latest
          with:
            preset: laravel
            verboseMode: true
            testMode: true
            configPath: "vendor/my-company/coding-style/pint.json"
            pintVersion: 1.8.0
            onlyDirty: true
          

ℹ️ Starting from version 2 you can specify the Pint version to be used by specifying a pintVersion in your configuration file.

If provided, a pint.json file in the root will be used for configuration during run of the Action.

This action DOESN'T commit changes automatically. If you want to achieve such behaviour you have to use it in combination with another action like git-auto-commit Action or Create Pull Request Action.

You can see Laravel Pint Action running on my demo repository.

laravel-pint-action's People

Contributors

aglipanci avatar ah-rahimi avatar erikn69 avatar jkharley avatar likeadeckofcards avatar nathanjms avatar niladam avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

laravel-pint-action's Issues

Tag mismatch

Current tag v2 doesn't point at the latest v2 tag (2.4)

Check only changed files in a PR

Is it possible for the pint to only the files which are modified in a PR and NOT all the project files?

Currently, we have a dirty project and we can not transform the whole code base in a large PR.
So we want to migrate gradually.

"onlyDirty: false" option does not work

Heya!

The GitHub Action's config onlyDirty: false does not work

As you can see in the attached screenshot, this setting is ignored. When the pint linter is run, the --dirty option is still on.

Screenshot 2023-08-01 at 11 55 29 am

Support only formatting changed files

When setting up this action, I expected the onlyDirty: true argument to only format changed files in the PR, since this is a fairly common use case for linting. However, it did not format anything, because all changes are already committed, and that is how Pint works.

I propose adding an option onlyChanged that would only format the files changed in the PR/commit. This was referenced in #5 (comment), and a workaround was given, to use another action to format only changed files. However, using the get all changed files action, I don't see any way that I would pass a list of files to format to Pint.

Allow running on macOS hosted runners

Recently, GitHub introduced free macOS runners that run on Apple Silicon. I am now getting the following error:

Error: Container action is only supported on Linux

It would be nice if this script could be allowed to run on Apple Silicon as well, perhaps making it even faster :)

Thanks!

Allow Pint version to be specified

The latest version of Pint 1.3.0 introduced some breaking changes, following the update to PHP CS Fixer 3.13.1.
For now we really need to stay on Pint 1.2.* as to not "fixing" a vast majority of files that are perfectly fine.

"onlyDirty" doesn't work.

The output command is as follows.

[Pint/pint] [DEBUG] Started container: c41969f571c43fbc5cd1d31f8ff9a4c74b63abd409f6c06d0669f6edcfc3e8f0
| Running Command:  composer global require laravel/pint:1.13 --no-progress --dev
| Changed current directory to /tmp
| The "1.13" constraint for "laravel/pint" appears too strict and will likely not match what you want. See https://getcomposer.org/constraints
| ./composer.json has been created
| Running composer update laravel/pint
| Loading composer repositories with package information
| Updating dependencies
| Lock file operations: 1 install, 0 updates, 0 removals
|   - Locking laravel/pint (v1.13.0)
| Writing lock file
| Installing dependencies from lock file (including require-dev)
| Package operations: 1 install, 0 updates, 0 removals
|   - Downloading laravel/pint (v1.13.0)
|   - Installing laravel/pint (v1.13.0): Extracting archive
| Generating autoload files
| No security vulnerability advisories found.
| Running Command:  pint --test -v --config laravel/pint.json --preset laravel

The script I want output is pint --test -v --config laravel/pint.json --preset laravel --dirty.

Is there a solution?

◎My Scripts

name: Pint

on:
  pull_request:
    paths:
      - '**.php'

jobs:
  pint:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v3
        # with:
        #   ref: ${{ github.head_ref }}
        #   token: "${{ secrets.GITHUB_TOKEN }}"

      - name: Apply Pint
        uses: aglipanci/[email protected]
        with:
          preset: laravel
          configPath: "laravel/pint.json"
          pintVersion: 1.13
          verboseMode: true
          testMode: true
          onlyDirty: true

issue with vscode

i'm having issue with runing pint in vscode
when i run

./vendor/bin/pint

it add all my projects file as changes when i check them there's no change on the file. why is that ?
also is there a possible config to check only the file that i have worked on not all the project ?

Missing tagging in major versions

Have a look at this article, maybe it helps:
michaelheap.com/semantic-versioning-for-github-actions
github.com/creating-actions/about-custom-actions#using-tags-for-release

  • Create a release on a release branch (such as release/v1, release/1) before creating the release tag (for example, v1.0.2).
  • Move the major version tag (v1, v2, etc.) to point to the Git ref of the current release. For more information, see "Git basics - tagging."

According to the documentation there should be tags for major releases(like aglipanci/laravel-pint-action@2)
major release tag must be updated on every new minor release(must point to latest)
Using major release tag helps keep the pint action updated, without having to modify yml in each minor release(latest)

git-scm.com/v2/Git-Basics-Tagging

To tag a commit, you specify the commit checksum (or part of it) at the end of the command:

git tag -a 2 859b17c

Where 859b17c it's the current release

All other "github actions" use major version tags, for example github.com/actions/checkout/tags:

image

Related #13
Please don't ignore it, it just a tag, easy to fix it

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.