Skip to content

ci: streamline shared setup action#379

Open
meganetaaan wants to merge 1 commit intodev/v1.0from
ops/harden-setup-action
Open

ci: streamline shared setup action#379
meganetaaan wants to merge 1 commit intodev/v1.0from
ops/harden-setup-action

Conversation

@meganetaaan
Copy link
Copy Markdown
Collaborator

@meganetaaan meganetaaan commented Mar 27, 2026

Cleans up the shared GitHub Actions setup action by using setup-node npm caching and clearer Moddable cache step naming.

Summary by CodeRabbit

  • Chores
    • Optimized GitHub Actions workflow configuration for improved build efficiency and clarity, enhancing dependency caching and installation step organization.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Mar 27, 2026

📝 Walkthrough

Walkthrough

The changes refactor the GitHub Actions setup composite action to use built-in npm caching from actions/setup-node@v4 instead of manual cache configuration, consolidate firmware dependency installation into a dedicated step, and rename multiple existing steps for clarity while preserving their logic and conditions.

Changes

Cohort / File(s) Summary
GitHub Actions Setup Configuration
.github/actions/setup/action.yml
Replaced manual npm cache step with built-in setup-node caching; added explicit step names; relocated firmware npm ci to dedicated step with working-directory; renamed Moddable/ESP32-related steps for consistency without altering their conditional logic or execution behavior.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

Possibly related PRs

Poem

🐰 Steps renamed with care and grace,
Cache now built-in, taking its place,
Firmware installs in their own space,
Actions flow smooth—a cleaner pace! 🚀

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'ci: streamline shared setup action' accurately and concisely summarizes the main change: refactoring the GitHub Actions setup workflow to improve clarity and efficiency through npm caching and step naming improvements.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ops/harden-setup-action

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
.github/actions/setup/action.yml (1)

39-56: Consider deduplicating apt-get update.

Both "Install Moddable" (line 42) and "Install ESP32" (line 53) run sudo apt-get update when the cache is not hit. Since these steps run sequentially under the same condition, the second call is redundant.

♻️ Suggested refactor: move apt-get update to a separate step or remove the duplicate
     - name: Install Moddable
       if: steps.restore-cache-moddable.outputs.cache-hit != 'true'
       run: |
-        sudo apt-get update
         if [ -z "${{ inputs.target-branch }}" ]; then
           npm run setup
         else
           npm run setup -- --target-branch ${{ inputs.target-branch }}
         fi
       working-directory: ./firmware
       shell: bash
     - name: Install ESP32
       if: steps.restore-cache-moddable.outputs.cache-hit != 'true'
       run: |
-        sudo apt-get update
+        sudo apt-get update  # Only needed here for ESP32 dependencies
         source $HOME/.local/share/xs-dev-export.sh && npm run setup -- --device=esp32
       working-directory: ./firmware
       shell: bash

Alternatively, add a dedicated "Update apt packages" step before both install steps:

    - name: Update apt packages
      if: steps.restore-cache-moddable.outputs.cache-hit != 'true'
      run: sudo apt-get update
      shell: bash
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/actions/setup/action.yml around lines 39 - 56, The two steps
"Install Moddable" and "Install ESP32" both run sudo apt-get update under the
same condition (steps.restore-cache-moddable.outputs.cache-hit != 'true');
remove the duplicate by extracting apt-get update into a separate step (e.g.,
"Update apt packages") that uses the same if condition and runs before both
"Install Moddable" and "Install ESP32", then delete the apt-get update line from
the bodies of the Install Moddable and Install ESP32 steps so they only run the
package-specific commands.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In @.github/actions/setup/action.yml:
- Around line 39-56: The two steps "Install Moddable" and "Install ESP32" both
run sudo apt-get update under the same condition
(steps.restore-cache-moddable.outputs.cache-hit != 'true'); remove the duplicate
by extracting apt-get update into a separate step (e.g., "Update apt packages")
that uses the same if condition and runs before both "Install Moddable" and
"Install ESP32", then delete the apt-get update line from the bodies of the
Install Moddable and Install ESP32 steps so they only run the package-specific
commands.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 9a13630a-344a-493e-b4f9-0c7f664431e2

📥 Commits

Reviewing files that changed from the base of the PR and between 20a4b1b and abb3177.

📒 Files selected for processing (1)
  • .github/actions/setup/action.yml

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant