GithubHelp home page GithubHelp logo

lucacome / prettier-cli-action Goto Github PK

View Code? Open in Web Editor NEW

This project forked from rutajdash/prettier-cli-action

0.0 1.0 0.0 15 KB

A GitHub action to run Prettier CLI Checks.

Home Page: https://github.com/marketplace/actions/prettier-check

License: MIT License

prettier-cli-action's Introduction

Prettier CLI Check

A GitHub action to run Prettier CLI Checks. This project was heavily inspired by other actions available and a shoutout to @creyD. The goal of this project was to create a simple action which would be easy to use.

Code Style Latest Release MIT License Issues Contributors Forks Stargazers

Usage

Parameters

Parameter Default Description
file_pattern '**/*.js' The file pattern prettier will check. Follow glob syntax.
config_path '' The path to the prettierrc file. Read more here.
ignore_path './.prettierignore' The path to the prettierignore file. This file should list file patterns to skip using the glob syntax.
prettier_version 'latest' The version of prettier to use. Find versions here.
fail_on_error true Whether the action should fail if prettier finds errors in formatting.

Output

You can access the list of files prettier found errors using the actions context like steps.<step-id>.outputs.prettier_output. The returned value is a list of files as a string, one per line.

Examples

name: Continuous Integration

# This action works with pull requests and pushes on the main branch
on:
  pull_request:
  push:
    branches: [main]

jobs:
  prettier:
    name: Prettier Check
    runs-on: ubuntu-latest
    steps:
      - name: Checkout Repository
        uses: actions/checkout@v2

      - name: Run Prettier
        id: prettier-run
        uses: rutajdash/[email protected]
        with:
          config_path: ./.prettierrc.yml

      # This step only runs if prettier finds errors causing the previous step to fail
      # This steps lists the files where errors were found
      - name: Prettier Output
        if: ${{ failure() }}
        shell: bash
        run: |
          echo "The following files are not formatted:"
          echo "${{steps.prettier-run.outputs.prettier_output}}"

More documentation for writing a workflow can be found here.

Issues

Please report all bugs and feature requests using the GitHub issues function. Thanks!

Contributing

Pull Requests are always welcome! Feel free to pick any issue or raise a new feature request! Do read the contributing guidelines and code of conduct.

prettier-cli-action's People

Contributors

rutajdash avatar

Watchers

 avatar

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.