-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: removes npm/yarn lint from steps #61
base: main
Are you sure you want to change the base?
Conversation
BREAKING CHANGE: consumers will need to specify required tasks as pre-commit steps, instead of package.json scripts
Error: missing breaking changes documentationThis pull request contains breaking changes, but no documentation has been added to Instructions for creating breaking changes document:mkdir -p docs/breaking-changes
cat <<EOF > docs/breaking-changes/v6.md
# Breaking changes in v6
[//]: # "Brief description of current major version release scope. (remove comment after updating)"
## Description of changes
[//]: # "Elaborate and add context to help the developer understand the changes. (remove comment after updating)"
## Upgrade instructions
[//]: # "Required and suggested prerequisites, example code, etc. (remove comment after updating)"
EOF |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just one question + missing breaking changes docs
- name: Check for yarn.lock | ||
id: check_yarn_lock | ||
uses: andstor/file-existence-action@v3 | ||
with: | ||
files: yarn.lock | ||
- name: Install dependencies (yarn) | ||
if: steps.check_yarn_lock.outputs.files_exists == 'true' | ||
shell: bash | ||
run: yarn --pure-lockfile | ||
env: | ||
NPM_AUTH_TOKEN: ${{ inputs.npm-auth-token }} | ||
- name: Install dependencies (npm) | ||
if: steps.check_yarn_lock.outputs.files_exists == 'false' | ||
shell: bash | ||
run: npm ci | ||
env: | ||
NPM_AUTH_TOKEN: ${{ inputs.npm-auth-token }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't we need to still install dependencies so that pre-commit hooks like eslint work?
We wanted to do something similar for open-turo/actions-python, looks like the leanest/fastest approach would be to run something along the lines of: jobs:
lint:
name: Lint
runs-on: [self-hosted, general-ubuntu]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup python
uses: actions/setup-python@v5 #or open-turo/action-setup-tools but action-setup-tools is quite slow for new version that are not pre-installed on the runners while the open source ones are caching everything and very fast
- name: Install pre-commit
run: pip install pre-commit
- name: Run pre-commit
run: pre-commit run --show-diff-on-failure --color=always --all-files we could also do caching on the pre-commit dependencies but I guess that's another level of optimization. It already runs in 10s-1minute with the above approach (vs 2-4minutes when installing dependencies) |
Description
We're running into a situation where parts of
yarn lint
end up running twice because they are both parth of pre-commit config and the package.json script.Instead of duplicating, we're going to ensure all pre-commit hooks are executed via pre-commit (or pre-commit run --all-files for general operation).
Changes
🚀 PR created with fotingo