Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 70 additions & 14 deletions .github/workflows/build-rad-ui.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,77 @@ on:
- 'src/**' # Only run when files in this directory change
- 'styles/**'
- 'package.json'

permissions:
contents: read

jobs:
build:
setup:
runs-on: ubuntu-latest
outputs:
node-modules-cache: ${{ steps.cache.outputs.cache-hit }}
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
Comment on lines +17 to +25
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Broken outputs reference – workflow will fail at runtime

steps.cache.outputs.cache-hit points to a step ID that doesn’t exist.
Because the actions/setup-node step has no id, the expression resolves to null and the whole job definition is syntactically invalid – GitHub Actions will refuse to run the workflow.

Fix by either (a) removing the unnecessary custom output or (b) giving the setup-node step an id and referencing that:

-    outputs:
-      node-modules-cache: ${{ steps.cache.outputs.cache-hit }}
+    outputs:
+      node-modules-cache: ${{ steps.setup-node.outputs.cache-hit }}

-      - name: Setup Node.js
-        uses: actions/setup-node@v4
+      - name: Setup Node.js
+        id: setup-node
+        uses: actions/setup-node@v4

Without this change the whole workflow is dead-on-arrival.

🧰 Tools
🪛 actionlint (1.7.7)

18-18: property "cache" is not defined in object type {}

(expression)

🤖 Prompt for AI Agents
In .github/workflows/build-rad-ui.yml around lines 17 to 25, the outputs section
references steps.cache.outputs.cache-hit, but there is no step with the ID
"cache" defined, causing the workflow to fail. Fix this by either removing the
outputs section if it is unnecessary or by adding an id: cache to the setup-node
step and ensuring the output reference matches that id. This will make the
output reference valid and prevent the workflow from being syntactically
invalid.

- name: Install dependencies
run: npm ci
Comment on lines +20 to +27
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

npm ci repeated in every job – burns minutes and cache storage

Each downstream job re-installs dependencies even though setup already did so.
Instead, cache node_modules (with actions/cache) or upload them as an artifact in setup and download in dependent jobs. This will shave several minutes from every run.

🤖 Prompt for AI Agents
In .github/workflows/build-rad-ui.yml around lines 20 to 27, the workflow runs
`npm ci` in every job, causing redundant dependency installations and wasting
time and cache storage. To fix this, remove the repeated `npm ci` commands from
downstream jobs and instead cache the `node_modules` directory using
`actions/cache` or upload `node_modules` as an artifact in the setup job and
download it in dependent jobs. This will reuse installed dependencies and speed
up the workflow.


test:
runs-on: ubuntu-latest
needs: setup
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Test
run: npm test

build_css:
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Clean dist
run: npm run clean
- name: Build CSS
run: npm run build:css

build_components:
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Clean dist
run: npm run clean
- name: Build Components
run: npm run build:components

build:
runs-on: ubuntu-latest
needs: [build_css, build_components]
steps:
- uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Build
run: npm run build
- name: Build Complete
run: echo "Build finished. CSS and components built in parallel after tests."
Loading
Loading