Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Aug 25, 2025

This PR consolidates the repetitive Node.js and pnpm installation steps that were duplicated across multiple GitHub Actions workflows by creating a reusable composite action.

Changes Made

Created Reusable Composite Action

  • Location: .github/actions/setup-node-pnpm/
  • Features:
    • Configurable Node.js version (defaults to LTS)
    • Automatic pnpm setup using project's configured version
    • Optional pnpm store caching for CI performance
    • Configurable lockfile handling (frozen vs regular)
    • Proper GITHUB_TOKEN environment variable handling

Updated Workflows

All three existing workflows now use the new composite action:

  • ci.yml: Uses caching and frozen lockfile for strict CI requirements
  • deploy.yml: Uses flexible settings appropriate for deployment
  • copilot-setup-steps.yml: Uses flexible settings for development environment

Benefits

  • Reduced code duplication: Eliminated ~40 lines of repeated setup code across workflows
  • Improved maintainability: Single source of truth for Node.js/pnpm setup configuration
  • Flexible configuration: Different workflows can specify appropriate settings via inputs
  • Better documentation: Clear usage examples and comprehensive input descriptions

Usage Example

- name: Setup Node.js and pnpm
  uses: ./.github/actions/setup-node-pnpm
  with:
    enable-cache: true
    frozen-lockfile: true

The action automatically handles Node.js LTS installation, pnpm setup, optional caching, and dependency installation while maintaining full compatibility with existing workflow requirements.

Fixes #30.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com>
Copilot AI changed the title [WIP] Reusable workflows Add reusable workflow for Node.js and pnpm setup Aug 25, 2025
Copilot AI requested a review from Boshen August 25, 2025 07:03
@Boshen Boshen marked this pull request as ready for review August 25, 2025 08:05
@Boshen Boshen merged commit 6cc9ca5 into main Aug 25, 2025
4 checks passed
@Boshen Boshen deleted the copilot/fix-30 branch August 25, 2025 08:05
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.

Reusable workflows

2 participants