diff --git a/.github/actions/setup-node-pnpm/action.yml b/.github/actions/setup-node-pnpm/action.yml new file mode 100644 index 0000000000..126d627245 --- /dev/null +++ b/.github/actions/setup-node-pnpm/action.yml @@ -0,0 +1,38 @@ +name: "Setup Node.js and pnpm" + +description: "Sets up Node.js and pnpm with caching and installs dependencies" + +inputs: + node-version: + description: "Node.js version to use" + required: false + default: "20.19.2" + pnpm-version: + description: "pnpm version to use" + required: false + default: "10.8.1" + skip-install: + description: "Skip dependency installation" + required: false + default: "false" + install-args: + description: "Additional arguments for pnpm install" + required: false + default: "" + +runs: + using: "composite" + steps: + - name: Install pnpm + uses: pnpm/action-setup@v4 + with: + version: ${{ inputs.pnpm-version }} + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: ${{ inputs.node-version }} + cache: "pnpm" + - name: Install dependencies + if: ${{ inputs.skip-install != 'true' }} + shell: bash + run: pnpm install ${{ inputs.install-args }} diff --git a/.github/workflows/changeset-release.yml b/.github/workflows/changeset-release.yml index adbc5dc966..1b291abcb7 100644 --- a/.github/workflows/changeset-release.yml +++ b/.github/workflows/changeset-release.yml @@ -9,8 +9,6 @@ on: env: REPO_PATH: ${{ github.repository }} GIT_REF: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || 'main' }} - NODE_VERSION: 20.19.2 - PNPM_VERSION: 10.8.1 jobs: # Job 1: Create version bump PR when changesets are merged to main @@ -31,18 +29,10 @@ jobs: with: fetch-depth: 0 ref: ${{ env.GIT_REF }} - - name: Install pnpm - uses: pnpm/action-setup@v4 + - name: Setup Node.js and pnpm + uses: ./.github/actions/setup-node-pnpm with: - version: ${{ env.PNPM_VERSION }} - - name: Setup Node.js - uses: actions/setup-node@v4 - with: - node-version: ${{ env.NODE_VERSION }} - cache: 'pnpm' - - - name: Install Dependencies - run: pnpm install + skip-checkout: 'true' # Check if there are any new changesets to process - name: Check for changesets diff --git a/.github/workflows/code-qa.yml b/.github/workflows/code-qa.yml index ac378b65cd..e34b0964ff 100644 --- a/.github/workflows/code-qa.yml +++ b/.github/workflows/code-qa.yml @@ -8,27 +8,14 @@ on: types: [opened, reopened, ready_for_review, synchronize] branches: [main] -env: - NODE_VERSION: 20.19.2 - PNPM_VERSION: 10.8.1 - jobs: check-translations: runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v4 - - name: Install pnpm - uses: pnpm/action-setup@v4 - with: - version: ${{ env.PNPM_VERSION }} - - name: Setup Node.js - uses: actions/setup-node@v4 - with: - node-version: ${{ env.NODE_VERSION }} - cache: 'pnpm' - - name: Install dependencies - run: pnpm install + - name: Setup Node.js and pnpm + uses: ./.github/actions/setup-node-pnpm - name: Verify all translations are complete run: node scripts/find-missing-translations.js @@ -37,17 +24,8 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v4 - - name: Install pnpm - uses: pnpm/action-setup@v4 - with: - version: ${{ env.PNPM_VERSION }} - - name: Setup Node.js - uses: actions/setup-node@v4 - with: - node-version: ${{ env.NODE_VERSION }} - cache: 'pnpm' - - name: Install dependencies - run: pnpm install + - name: Setup Node.js and pnpm + uses: ./.github/actions/setup-node-pnpm - name: Run knip checks run: pnpm knip @@ -56,17 +34,8 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v4 - - name: Install pnpm - uses: pnpm/action-setup@v4 - with: - version: ${{ env.PNPM_VERSION }} - - name: Setup Node.js - uses: actions/setup-node@v4 - with: - node-version: ${{ env.NODE_VERSION }} - cache: 'pnpm' - - name: Install dependencies - run: pnpm install + - name: Setup Node.js and pnpm + uses: ./.github/actions/setup-node-pnpm - name: Lint run: pnpm lint - name: Check types @@ -80,17 +49,8 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v4 - - name: Install pnpm - uses: pnpm/action-setup@v4 - with: - version: ${{ env.PNPM_VERSION }} - - name: Setup Node.js - uses: actions/setup-node@v4 - with: - node-version: ${{ env.NODE_VERSION }} - cache: 'pnpm' - - name: Install dependencies - run: pnpm install + - name: Setup Node.js and pnpm + uses: ./.github/actions/setup-node-pnpm - name: Run unit tests run: pnpm test @@ -116,17 +76,8 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v4 - - name: Install pnpm - uses: pnpm/action-setup@v4 - with: - version: ${{ env.PNPM_VERSION }} - - name: Setup Node.js - uses: actions/setup-node@v4 - with: - node-version: ${{ env.NODE_VERSION }} - cache: 'pnpm' - - name: Install dependencies - run: pnpm install + - name: Setup Node.js and pnpm + uses: ./.github/actions/setup-node-pnpm - name: Create .env.local file working-directory: apps/vscode-e2e run: echo "OPENROUTER_API_KEY=${{ secrets.OPENROUTER_API_KEY }}" > .env.local diff --git a/.github/workflows/marketplace-publish.yml b/.github/workflows/marketplace-publish.yml index 0719029e9d..5a88e61dc2 100644 --- a/.github/workflows/marketplace-publish.yml +++ b/.github/workflows/marketplace-publish.yml @@ -7,8 +7,6 @@ on: env: GIT_REF: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || 'main' }} - NODE_VERSION: 20.19.2 - PNPM_VERSION: 10.8.1 jobs: publish-extension: @@ -25,17 +23,10 @@ jobs: uses: actions/checkout@v4 with: ref: ${{ env.GIT_REF }} - - name: Install pnpm - uses: pnpm/action-setup@v4 + - name: Setup Node.js and pnpm + uses: ./.github/actions/setup-node-pnpm with: - version: ${{ env.PNPM_VERSION }} - - name: Setup Node.js - uses: actions/setup-node@v4 - with: - node-version: ${{ env.NODE_VERSION }} - cache: 'pnpm' - - name: Install dependencies - run: pnpm install + skip-checkout: 'true' - name: Configure Git run: | git config user.name "github-actions[bot]" diff --git a/.github/workflows/nightly-publish.yml b/.github/workflows/nightly-publish.yml index b7710f29d0..011d1df3f1 100644 --- a/.github/workflows/nightly-publish.yml +++ b/.github/workflows/nightly-publish.yml @@ -8,10 +8,6 @@ on: branches: [main] workflow_dispatch: # Allows manual triggering. -env: - NODE_VERSION: 20.19.2 - PNPM_VERSION: 10.8.1 - jobs: publish-nightly: runs-on: ubuntu-latest @@ -25,17 +21,11 @@ jobs: uses: actions/checkout@v4 with: fetch-depth: 0 - - name: Install pnpm - uses: pnpm/action-setup@v4 - with: - version: ${{ env.PNPM_VERSION }} - - name: Setup Node.js - uses: actions/setup-node@v4 + - name: Setup Node.js and pnpm + uses: ./.github/actions/setup-node-pnpm with: - node-version: ${{ env.NODE_VERSION }} - cache: 'pnpm' - - name: Install dependencies - run: pnpm install --frozen-lockfile + skip-checkout: 'true' + install-args: '--frozen-lockfile' - name: Forge numeric Nightly version id: version env: diff --git a/.github/workflows/update-contributors.yml b/.github/workflows/update-contributors.yml index d4e9768fb7..4dd36bfe29 100644 --- a/.github/workflows/update-contributors.yml +++ b/.github/workflows/update-contributors.yml @@ -4,36 +4,23 @@ on: push: branches: - main - workflow_dispatch: # Allows manual triggering - -env: - NODE_VERSION: 20.19.2 - PNPM_VERSION: 10.8.1 + workflow_dispatch: jobs: update-contributors: runs-on: ubuntu-latest permissions: - contents: write # Needed for pushing changes - pull-requests: write # Needed for creating PRs + contents: write # Needed for pushing changes. + pull-requests: write # Needed for creating PRs. steps: - name: Checkout code uses: actions/checkout@v4 - - name: Install pnpm - uses: pnpm/action-setup@v4 - with: - version: ${{ env.PNPM_VERSION }} - - name: Setup Node.js - uses: actions/setup-node@v4 - with: - node-version: ${{ env.NODE_VERSION }} - cache: 'pnpm' + - name: Setup Node.js and pnpm + uses: ./.github/actions/setup-node-pnpm - name: Disable Husky run: | echo "HUSKY=0" >> $GITHUB_ENV git config --global core.hooksPath /dev/null - - name: Install dependencies - run: pnpm install - name: Update contributors and format run: | pnpm update-contributors