[Feature] Install Dependencies If Change Detected in Service
Huzaifa-Asif opened this issue · 1 comments
Is this feature missing in the latest version?
- I'm using the latest release
Is your feature request related to a problem? Please describe.
I have a microservices Setup i install dependencies for all the services first then do linting, but the problem is if there is no change still install step is executed and make the process slow. So i was think that i should only do install if there is a change in that service. and to execute this workflow i have combined all the dependencies in the base directory package json which is also not correct as it should only install package in each service rather then installing all the packages.
Describe the solution you'd like?
I am pasting my current action file for the reference.
name: ESLint Changed Files
on:
pull_request:
types: [opened, synchronize, ready_for_review]
branches:
- 'flight/**'
jobs:
eslint-check:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [14.x]
steps:
- name: Check out code
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
run: npm install --ignore-scripts
env:
NODE_OPTIONS: "--max_old_space_size=4096"
- name: App Eslint
if: ${{ ! cancelled() }}
uses: tj-actions/eslint-changed-files@v21
with:
path: "app/"
# extra_args: "--fix"
config_path: ".eslintrc.js"
ignore_path: ".eslintignore"
skip_annotations: false
token: ${{ secrets.GITHUB_TOKEN }}
file_extensions: |
**/*.{js,vue,json}
- name: Webchat Eslint
if: ${{ ! cancelled() }}
uses: tj-actions/eslint-changed-files@v21
with:
path: "webchat/"
# extra_args: "--fix"
config_path: ".eslintrc.js"
ignore_path: ".eslintignore"
skip_annotations: false
token: ${{ secrets.GITHUB_TOKEN }}
file_extensions: |
**/*.{js,jsx}
- name: Widget Eslint
if: ${{ ! cancelled() }}
uses: tj-actions/eslint-changed-files@v21
with:
path: "widget/"
# extra_args: "--fix"
config_path: ".eslintrc.cjs"
ignore_path: ".eslintignore"
skip_annotations: false
token: ${{ secrets.GITHUB_TOKEN }}
file_extensions: |
**/*.{js,jsx}
Describe alternatives you've considered?
I can use install with working-directory: but still i have to write install step 3 times for each service. and it will install modules even if there is no change.
For example:
- name: Install dependencies for app
run: yarn install
working-directory: app
- name: Install dependencies for webchat
run: yarn install
working-directory: webchat
- name: Install dependencies for widget
run: yarn install
working-directory: widget
i can add these step before the main eslint step of each service but it doesn't solve the issue. I need some condition so that this install step of each service is only executed if there is a change in that service.
Anything else?
No response
Code of Conduct
- I agree to follow this project's Code of Conduct
Hi @Huzaifa-Asif, for change detection, See: https://github.com/tj-actions/changed-files#using-local-git-history-