perf: optimize calculating monthly report data and add package manager #29
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Find unused files, dependencies and exports in JavaScript and TypeScript projects. | |
name: Knip | |
on: | |
workflow_dispatch: | |
pull_request: | |
types: | |
- opened | |
- synchronize | |
env: | |
CACHE_NAME: cache-node-modules | |
jobs: | |
knip: | |
name: Knip | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Get yarn cache directory path | |
id: yarn-cache-dir-path | |
run: echo "yarn_cache_dir=$(yarn cache dir)" >> $GITHUB_OUTPUT | |
- name: Cache node modules | |
id: cache-yarn | |
uses: actions/cache@v4 | |
with: | |
# Below is an another cache folder on ubuntu | |
# path: ~/.cache/yarn | |
path: ${{ steps.yarn-cache-dir-path.outputs.yarn_cache_dir }} | |
key: ${{ runner.os }}-build-${{ env.CACHE_NAME }}\ | |
-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: ${{ runner.os }}-build-${{ env.CACHE_NAME }}- | |
${{ runner.os }}-build- | |
${{ runner.os }}- | |
- if: ${{ steps.cache-yarn.outputs.cache-hit != 'true' }} | |
name: Info the state of node modules | |
continue-on-error: true | |
run: yarn info --name-only | |
- name: Install Dependencies | |
run: yarn install --immutable | |
- name: Run Knip | |
continue-on-error: true | |
run: yarn knip |