Back to all reviewers

extract reusable workflow components

electron/electron
Based on 2 comments
Yaml

Avoid duplicating workflow steps across multiple CI/CD pipelines by extracting common functionality into reusable actions. This improves maintainability, reduces inconsistencies, and ensures proper cross-platform compatibility when needed.

CI/CD Yaml

Reviewer Prompt

Avoid duplicating workflow steps across multiple CI/CD pipelines by extracting common functionality into reusable actions. This improves maintainability, reduces inconsistencies, and ensures proper cross-platform compatibility when needed.

When you find yourself copying similar workflow steps across multiple pipeline files, create a composite action instead. Pay special attention to cross-platform scenarios where caching or other features may require specific configuration.

Example of extracting a common dependency installation step:

# Before: Duplicated across multiple workflows
- name: Get yarn cache directory path
  # ... repeated setup code

# After: Extract to .github/actions/install-dependencies/action.yml
- name: Install Dependencies
  uses: ./.github/actions/install-dependencies
  with:
    enable-cross-platform-cache: true

For cross-platform workflows, ensure proper configuration like enableCrossOsArchive: true when caching between different operating systems. This prevents cache restoration failures when artifacts are saved on one platform and restored on another.

2
Comments Analyzed
Yaml
Primary Language
CI/CD
Category

Source Discussions