@@ -24,12 +24,16 @@ jobs:
2424 timeout-minutes : 3
2525 # Map a step output to a job output
2626 outputs :
27- eslint_config : ${{ steps.changes.outputs.eslint_config }}
28- frontend : ${{ steps.changes.outputs.frontend_all }}
29- frontend_components_modified_lintable : ${{ steps.changes.outputs.frontend_components_modified_lintable }}
30- frontend_components_modified_lintable_files : ${{ steps.changes.outputs.frontend_components_modified_lintable_files }}
31- frontend_modified_lintable_files : ${{ steps.changes.outputs.frontend_modified_lintable_files }}
32- yarn_lockfile : ${{ steps.changes.outputs.yarn_lockfile }}
27+ lintable_css_in_js_modified : ${{ steps.changes.outputs.lintable_css_in_js_modified }}
28+ lintable_css_in_js_modified_files : ${{ steps.changes.outputs.lintable_css_in_js_modified_files }}
29+ lintable_css_in_js_rules_changed : ${{ steps.changes.output.lintable_css_in_js_rules_changed }}
30+ lintable_modified : ${{ steps.changes.outputs.lintable_modified }}
31+ lintable_modified_files : ${{ steps.changes.outputs.lintable_modified_files }}
32+ lintable_rules_changed : ${{ steps.changes.outputs.lintable_rules_changed }}
33+ testable_modified : ${{ steps.changes.outputs.testable_modified }}
34+ testable_modified_files : ${{ steps.changes.outputs.testable_modified_files }}
35+ testable_rules_changed : ${{ steps.changes.outputs.testable_rules_changed }}
36+ frontend_all : ${{ steps.changes.outputs.frontend_all }}
3337 steps :
3438 - uses : actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
3539
4246 list-files : shell
4347
4448 typescript-and-lint :
45- if : needs.files-changed.outputs.frontend == 'true'
49+ if : needs.files-changed.outputs.frontend_all == 'true'
4650 needs : files-changed
4751 name : typescript and lint
4852 runs-on : ubuntu-22.04
@@ -70,49 +74,52 @@ jobs:
7074 echo "::add-matcher::.github/tsc.json"
7175 echo "::add-matcher::.github/eslint-stylish.json"
7276
73- - name : eslint logic
74- id : eslint
75- if : (github.ref == 'refs/heads/master' || needs.files-changed.outputs.eslint_config == 'true' || needs.files-changed.outputs.yarn_lockfile == 'true')
76- run : echo "all-files=true" >> "$GITHUB_OUTPUT"
77-
78- # Lint entire frontend if:
79- # - this is on main branch
80- # - eslint configuration in repo has changed
81- # - yarn lockfile has changed (i.e. we bump our eslint config)
82- - name : eslint
83- if : steps.eslint.outputs.all-files == 'true'
84- env :
85- # Run relax config on main branch (and stricter config for changed files)
86- SENTRY_ESLINT_RELAXED : 1
87- run : yarn lint
77+ # When we're on master we can run all tasks across all files
78+ # or if lint rules have changed, run the related task across all files
79+ - name : biome (all files)
80+ if : github.ref == 'refs/heads/master'
81+ run : yarn lint:biome
82+
83+ - name : prettier (all files)
84+ if : github.ref == 'refs/heads/master' || needs.files-changed.outputs.lintable_rules_changed == 'true'
85+ run : yarn lint:prettier
86+
87+ - name : eslint (all files)
88+ if : github.ref == 'refs/heads/master' || needs.files-changed.outputs.lintable_rules_changed == 'true'
89+ run : yarn lint:js
90+
91+ - name : stylelint (all files)
92+ if : github.ref == 'refs/heads/master' || needs.files-changed.outputs.lintable_css_in_js_rules_changed == 'true'
93+ run : yarn lint:css
94+
95+ # When on a PR branch, we only need to look at the changed files
96+ - name : biome (fix)
97+ if : github.ref != 'refs/heads/master'
98+ run : yarn fix:biome
99+
100+ - name : prettier (changed files only)
101+ if : github.ref != 'refs/heads/master' && needs.files-changed.outputs.lintable_rules_changed != 'true' && needs.files-changed.outputs.lintable_modified == 'true'
102+ run : yarn prettier --write ${{ needs.files-changed.outputs.lintable_modified_files }}
88103
89- # Otherwise... only lint modified files
90- # Note `eslint --fix` will not fail when it auto fixes files
91104 - name : eslint (changed files only)
92- if : steps.eslint.outputs.all-files != 'true'
93- run : |
94- yarn eslint --fix ${{ needs.files-changed.outputs.frontend_modified_lintable_files }}
105+ if : github.ref != 'refs/heads/master' && needs.files-changed.outputs.lintable_rules_changed != 'true' && needs.files-changed.outputs.lintable_modified == 'true'
106+ run : yarn eslint --fix ${{ needs.files-changed.outputs.lintable_modified_files }}
95107
96108 - name : stylelint (changed files only)
97- if : github.ref != 'refs/heads/master' && needs.files-changed.outputs.frontend_components_modified_lintable == 'true'
98- run : |
99- yarn stylelint ${{ needs.files-changed.outputs.frontend_components_modified_lintable_files }}
100-
101- - name : biome
102- if : github.ref != 'refs/heads/master' && needs.files-changed.outputs.frontend_components_modified_lintable == 'true'
103- run : yarn biome check . --apply
109+ if : github.ref != 'refs/heads/master' && needs.files-changed.outputs.lintable_css_in_js_rules_changed != 'true' && needs.files-changed.outputs.lintable_css_in_js_modified == 'true'
110+ run : yarn stylelint ${{ needs.files-changed.outputs.lintable_css_in_js_modified_files }}
104111
105112 # Check (and error) for dirty working tree for forks
106113 # Reason being we need a different token to auto commit changes and
107114 # forks do not have access to said token
108115 - name : Check for dirty git working tree (forks)
109- if : steps.token.outcome != 'success ' && github.ref != 'refs/heads/master '
116+ if : github.ref != 'refs/heads/master ' && steps.token.outcome != 'success '
110117 run : |
111118 git diff --quiet || (echo '::error ::lint produced file changes, run linter locally and try again' && exit 1)
112119
113120 # If working tree is dirty, commit and update if we have a token
114121 - name : Commit any eslint fixed files
115- if : steps.token.outcome == 'success ' && github.ref != 'refs/heads/master '
122+ if : github.ref != 'refs/heads/master ' && steps.token.outcome == 'success '
116123 uses : getsentry/action-github-commit@31f6706ca1a7b9ad6d22c1b07bf3a92eabb05632 # v2.0.0
117124 with :
118125 github-token : ${{ steps.token.outputs.token }}
@@ -124,7 +131,7 @@ jobs:
124131 run : yarn tsc -p config/tsconfig.ci.json
125132
126133 frontend-jest-tests :
127- if : needs.files-changed.outputs.frontend == 'true'
134+ if : needs.files-changed.outputs.testable_rules_changed == 'true' || needs.files-changed.outputs.testable_modified == 'true'
128135 needs : files-changed
129136 name : Jest
130137 # If you change the runs-on image, you must also change the runner in jest-balance.yml
@@ -137,6 +144,7 @@ jobs:
137144 fail-fast : false
138145 matrix :
139146 # XXX: When updating this, make sure you also update CI_NODE_TOTAL.
147+
140148 instance : [0, 1, 2, 3]
141149
142150 steps :
@@ -186,7 +194,7 @@ jobs:
186194 # it reduces large coverage fluctuations.
187195 - name : Handle artifacts
188196 uses : ./.github/actions/artifacts
189- if : ${{ always() && needs.files-changed.outputs.frontend_all == 'true' }}
197+ if : always()
190198 with :
191199 files : .artifacts/coverage/*
192200 type : frontend
0 commit comments