Giter Site home page Giter Site logo

dukemanh / scoped-actions Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 1.0 1.17 MB

Run Prettier, Eslint on changed files and run test on changed workspaces

License: MIT License

JavaScript 23.59% Shell 2.96% TypeScript 73.45%
actionshackathon21 githubactions

scoped-actions's Introduction

Scoped Actions

Scoped-actions is a GitHub Action to run commands on only changed files or changed workspaces of a Node project.

Pass any commands to be executed, when a command is one of the following, extra arguments are appended to make sure the commands only run on changed files or changed workspaces.

Commands:

  • lint | eslint: Run lint tool on changed and added files
  • prettier: Run prettier on changed and added files
  • test | jest: Run test on changed workspaces of a monorepo

Inputs

files

Required: Changed and added files

files: ${{ steps.files.outputs.added_modified}}

This action uses jitterbit/get-changed-files to get changed and added files of a push or pull request.

- id: files
  uses: jitterbit/get-changed-files@v1
  with:
    format: csv
    token: ${{ github.token }}

eslintTarget

Target glob pattern for ESLint, e.g: '**/*.{jsx,tsx,ts,js}'

s<n>

Commands to be run in steps, e.g:

s0: 'npm install'
s1: 'npm run prettier-check'
s2: 'npm run lint'
s3: 'npm run test'

Example Usage

NOTE: Because extra arguments and options need to be appended to given commands, make sure your package.json scripts don't end with a double dash --.

on: [push, pull_request]

jobs:
run-test:
runs-on: ubuntu-latest
name: Run test, lint tool, code formatter on changed files and workspaces
steps:
  - name: Checkout
    uses: actions/checkout@v2

  - id: files
    uses: jitterbit/get-changed-files@v1
    with:
      format: csv
      token: ${{ github.token }}
  - name: Run scoped actions
    uses: DukeManh/scoped-actions@v1
    with:
      files: ${{ steps.files.outputs.added_modified}}
      eslintTarget: '**/*.{jsx,tsx,ts,js}'
      s0: 'npm install'
      s1: 'npm run prettier-check'
      s2: 'npm run lint'
      s3: 'npm run test'

scoped-actions's People

Contributors

dukemanh avatar

Stargazers

 avatar  avatar

Watchers

 avatar

scoped-actions's Issues

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.