-
Notifications
You must be signed in to change notification settings - Fork 2k
Chore(UI): Add pretty and eslint for openmetadata-ui-core-components for code quality #26686
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
Changes from all commits
31478e5
e67088c
e6fa812
f2df097
3f37ec3
059b01f
b4b8493
4edf723
c2c5c2e
e96df9f
4147533
852fefc
b969112
72a926a
b375386
8a37fec
c1c3e2e
baf0131
368443a
bad6c59
c0559a8
a1da5d4
1fd7a10
0a18f96
1bcf116
2672de6
c641e89
daf11cd
a25d116
b662090
a11a993
3f60cc0
fa064b8
b416ecc
c7ab426
a921ffc
4e23ba4
37f4a2e
b8c3ff0
4bdee8f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -25,6 +25,7 @@ | |||||
| - ".github/workflows/ui-checkstyle.yml" | ||||||
| - openmetadata-ui/src/main/resources/ui/playwright/** | ||||||
| - openmetadata-ui/src/main/resources/ui/eslint.config.mjs | ||||||
| - "openmetadata-ui-core-components/src/main/resources/ui/**" | ||||||
|
|
||||||
| permissions: | ||||||
| contents: read | ||||||
|
|
@@ -35,14 +36,15 @@ | |||||
|
|
||||||
| env: | ||||||
| UI_WORKING_DIRECTORY: openmetadata-ui/src/main/resources/ui | ||||||
| CORE_COMPONENTS_WORKING_DIRECTORY: openmetadata-ui-core-components/src/main/resources/ui | ||||||
|
|
||||||
| jobs: | ||||||
| # ────────────────────────────────────────────────────────────────────────── | ||||||
| # Job 0: Authorize | ||||||
| # ────────────────────────────────────────────────────────────────────────── | ||||||
| authorize: | ||||||
| if: | | ||||||
| github.event_name == 'pull_request_target' && | ||||||
| github.event_name == 'pull_request_target' && | ||||||
| (github.event.action != 'labeled' || github.event.label.name == 'safe to test') | ||||||
| runs-on: ubuntu-latest | ||||||
| steps: | ||||||
|
|
@@ -104,14 +106,14 @@ | |||||
| files_ignore: | | ||||||
| src/generated/** | ||||||
| files: | | ||||||
| src/**/*.{ts,tsx,js,jsx} | ||||||
| src/**/*.{ts,tsx,js,jsx,json} | ||||||
|
|
||||||
| - name: ESLint + Prettier + Organise Imports | ||||||
| id: lint | ||||||
| if: steps.changed-files.outputs.any_changed == 'true' | ||||||
| working-directory: ${{ env.UI_WORKING_DIRECTORY }} | ||||||
| env: | ||||||
| CHANGED_FILES: ${{ steps.changed-files.outputs.added_modified_files }} | ||||||
| CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }} | ||||||
|
||||||
| CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }} | |
| CHANGED_FILES: ${{ steps.changed-files.outputs.added_modified_files }} |
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.
⚠️ Bug: all_changed_files includes deleted files, breaking lint on removal PRs
The switch from added_modified_files to all_changed_files in the tj-actions/changed-files output means deleted files will also be passed to ESLint and Prettier. When a PR removes a .ts/.tsx file, the lint step will attempt to process a file that no longer exists on disk, causing the CI job to fail with a file-not-found error.
This affects both the existing UI jobs (lines 116, 216, 576) and the new core-components job (line 779).
Suggested fix:
Use `added_modified_files` (the original value) instead of `all_changed_files`, or filter the list to exclude deleted files:
CHANGED_FILES: ${{ steps.changed-files.outputs.added_modified_files }}
Was this helpful? React with 👍 / 👎 | Reply gitar fix to apply this suggestion
Copilot
AI
Mar 23, 2026
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.
Switching from pull_request_target to pull_request improves security, but it also commonly removes pull-requests: write capabilities for PRs originating from forks (GitHub restricts the GITHUB_TOKEN to read-only in that case). The steps that create/update/delete PR comments can fail due to insufficient permissions. Consider gating PR-comment steps to same-repo PRs (e.g., if: github.event.pull_request.head.repo.full_name == github.repository), or splitting comments into a pull_request_target workflow that only reads artifacts/results and never checks out untrusted code.
Check failure
Code scanning / CodeQL
Checkout of untrusted code in a privileged context Critical
pull_request_target
Check failure
Code scanning / CodeQL
Checkout of untrusted code in a privileged context Critical
pull_request_target
Copilot
AI
Mar 25, 2026
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.
Two operational issues here:
all_changed_filescan include deleted files; passing those paths to Prettier (--write) commonly fails because the files no longer exist. Preferadded_modified_files(or explicitly excludedeleted_files) for both UI and core-components lint steps.- Switching from
pull_request_targettopull_requestcan prevent PR commenting for contributions from forks (the token is typically read-only, even if the workflow requestspull-requests: write). If PR comments are required, consider keepingpull_request_targetwith appropriate safety gating, or change the workflow to report via checks/artifacts instead of writing PR comments.
Copilot
AI
Mar 25, 2026
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.
Using all_changed_files can include deleted/renamed paths depending on the action output, which will make eslint/prettier fail when they receive non-existent files. Also, including *.json here means ESLint may error or warn unless JSON is explicitly supported in the ESLint config. A safer approach is to use only added/modified files for ESLint/Prettier inputs (e.g., added_modified_files) and either exclude json from ESLint inputs or add a JSON parser/plugin/config for JSON files.
Check failure
Code scanning / CodeQL
Checkout of untrusted code in a privileged context Critical
pull_request_target
Copilot
AI
Mar 23, 2026
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.
Switching from pull_request_target to pull_request improves security, but it also commonly removes pull-requests: write capabilities for PRs originating from forks (GitHub restricts the GITHUB_TOKEN to read-only in that case). The steps that create/update/delete PR comments can fail due to insufficient permissions. Consider gating PR-comment steps to same-repo PRs (e.g., if: github.event.pull_request.head.repo.full_name == github.repository), or splitting comments into a pull_request_target workflow that only reads artifacts/results and never checks out untrusted code.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| v22.17.0 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| # Copyright 2021 Collate | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| # Node | ||
| node/ | ||
|
|
||
| # Dependencies | ||
| node_modules/ | ||
|
|
||
| # Production | ||
| build/ | ||
| dist/ | ||
|
|
||
| # macOS | ||
| .DS_Store | ||
|
|
||
| # Ignore files (Prettier has trouble parsing files without extension) | ||
| .gitignore | ||
| .prettierignore | ||
|
|
||
| # Assets | ||
| *.gif | ||
| *.svg | ||
| *.png | ||
| *.ico | ||
| *.ttf | ||
| *.md | ||
| *.webp | ||
| *.jpg | ||
| *.jpeg | ||
|
|
||
| # Snapshots | ||
| *.snap |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| # | ||
| # Copyright 2022 Collate. | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
| # | ||
| --- | ||
| tabWidth: 2 | ||
| bracketSameLine: true | ||
| htmlWhitespaceSensitivity: 'strict' | ||
| singleQuote: true |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,3 @@ | ||
| body { | ||
| font-family: "Inter", "Poppins", sans-serif; | ||
| font-family: 'Inter', 'Poppins', sans-serif; | ||
| } |
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.
Switching the workflow from
pull_request_targettopull_requestcan break PR commenting/updates (e.g.,pull-requests: write) on PRs coming from forks because the GitHub token is read-only in that context. If you need automated PR comments, consider either (a) gating comment-writing steps to only run whengithub.event.pull_request.head.repo.full_name == github.repository, or (b) splitting into a safepull_requestcheck job (no comments) plus apull_request_targetjob that only posts comments using trusted data.