diff --git a/.github/file-filters.yml b/.github/file-filters.yml index 8285f01b1d0f..497ae767c027 100644 --- a/.github/file-filters.yml +++ b/.github/file-filters.yml @@ -39,6 +39,21 @@ mdx_typecheckable: &mdx_typecheckable - added|deleted|modified: 'static/app/components/core/**/*.{ts,tsx}' - added|deleted|modified: 'static/**/__stories__/**/*.{ts,tsx}' +lintable_modified: &lintable_modified + - *sentry_frontend_workflow_file + - *sentry_frontend_snapshots_workflow_file + - added|modified: '**/*.{ts,tsx,js,jsx,mjs}' + - added|modified: 'static/**/*.{less,json,yml,md,mdx}' + - added|modified: '{vercel,tsconfig,biome,package}.json' + +lintable_rules_changed: &lintable_rules_changed + - *sentry_frontend_workflow_file + - *sentry_frontend_snapshots_workflow_file + - added|modified: 'package.json' + - added|modified: '.github/file-filters.yml' + - added|modified: '*.config.ts' + - added|modified: 'static/eslint/**/*.{ts,tsx,js,jsx,mjs}' + # Trigger to apply the 'Scope: Frontend' label to PRs frontend_all: &frontend_all - *sentry_frontend_workflow_file diff --git a/.github/workflows/frontend.yml b/.github/workflows/frontend.yml index 3d17cb526c87..80c6310c737e 100644 --- a/.github/workflows/frontend.yml +++ b/.github/workflows/frontend.yml @@ -28,7 +28,11 @@ jobs: testable_rules_changed: ${{ steps.changes.outputs.testable_rules_changed }} typecheckable_rules_changed: ${{ steps.changes.outputs.typecheckable_rules_changed }} mdx_typecheckable: ${{ steps.changes.outputs.mdx_typecheckable }} + lintable_modified: ${{ steps.changes.outputs.lintable_modified }} + lintable_modified_files: ${{ steps.changes.outputs.lintable_modified_files }} + lintable_rules_changed: ${{ steps.changes.outputs.lintable_rules_changed }} frontend_all: ${{ steps.changes.outputs.frontend_all }} + frontend_all_files: ${{ steps.changes.outputs.frontend_all_files }} merge_base: ${{ steps.merge_base.outputs.merge_base }} merge_base_strategy: ${{ steps.merge_base.outputs.merge_base_strategy }} steps: @@ -128,7 +132,15 @@ jobs: - name: eslint id: eslint - run: pnpm run lint:js + env: + LINTABLE_RULES_CHANGED: ${{ needs.files-changed.outputs.lintable_rules_changed }} + LINTABLE_MODIFIED_FILES: ${{ needs.files-changed.outputs.lintable_modified_files }} + run: | + if [[ "$GITHUB_EVENT_NAME" == "pull_request" && "$LINTABLE_RULES_CHANGED" == "false" ]]; then + pnpm run lint:js $LINTABLE_MODIFIED_FILES + else + pnpm run lint:js + fi knip: if: needs.files-changed.outputs.frontend_all == 'true'