Skip to content

Update shared test action to remove deprecated cache v2 usage#41

Merged
aleks-pro merged 3 commits into
mainfrom
copilot/update-cache-actions-to-v4
May 12, 2026
Merged

Update shared test action to remove deprecated cache v2 usage#41
aleks-pro merged 3 commits into
mainfrom
copilot/update-cache-actions-to-v4

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 12, 2026

Downstream workflows consuming DevExpress/testcafe-build-system were failing at job setup because actions/cache@v2 is now hard-failed by GitHub. This PR updates the shared action path used by downstream repos to restore workflow startup compatibility.

  • Scope

    • Updated actions/test-npm/action.yml (the only location in this repo using actions/cache@v2).
  • Cache action migration

    • Replaced deprecated cache action with supported version:
      • actions/cache@v2actions/cache@v4
    • Kept cache contract unchanged (path, key, restore-keys) to preserve current cache behavior.
  • Related workflow command deprecation cleanup

    • Replaced deprecated set-output usage with $GITHUB_OUTPUT in the same composite action step to align with current Actions runtime behavior.
- id: npm-cache-dir
  shell: bash
  run: echo "dir=$(npm config get cache)" >> "$GITHUB_OUTPUT"

- uses: actions/cache@v4
  id: npm-cache
  with:
    path: ${{ steps.npm-cache-dir.outputs.dir }}
    key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
    restore-keys: |
      ${{ runner.os }}-node-
Original prompt

Fix the deprecated GitHub Actions cache usage in the shared build-system actions used by downstream repositories.

Context:

  • A downstream workflow in DevExpress/testcafe-browser-provider-browserstack failed before tests started.
  • The failing job reported: This request has been automatically failed because it uses a deprecated version of actions/cache: v2. Please update your workflow to use v3/v4 of actions/cache to avoid interruptions.
  • The downstream workflow uses shared actions from this repository:
    • DevExpress/testcafe-build-system/actions/prepare@main
    • DevExpress/testcafe-build-system/actions/build@main
    • DevExpress/testcafe-build-system/actions/test-npm@main

Task:

  1. Search this repository for any usage of actions/cache@v2 in reusable actions/workflows, especially under actions/prepare, actions/build, and actions/test-npm.
  2. Update all deprecated actions/cache@v2 references to a supported version, preferably actions/cache@v4.
  3. Verify whether any related cache inputs or behavior need adjustment for compatibility with v4.
  4. If there are tests or validation workflows relevant to these actions, update them if necessary.
  5. Create a pull request with a concise summary of the fix and its impact on downstream workflows.

Goal:
Restore compatibility with GitHub Actions by removing deprecated cache action usage so downstream repos can run CI successfully again.

The following is the prior conversation context from the user's chat exploration (may be truncated):

User: Please find a solution for this failing job. Use the logs, job definition, and any referenced files where the failure occurred. Keep your response focused on the solution and include code suggestions when appropriate.

Assistant: The failure is in the workflow setup, not in the test code.

Root cause

The job was auto-failed because one of the reused actions in the workflow still depends on a deprecated actions/cache@v2:

This request has been automatically failed because it uses a deprecated version of actions/cache: v2.

The failing job is defined in .github/workflows/test.yml, and both jobs use shared DevExpress actions:

  • DevExpress/testcafe-build-system/actions/prepare@main at lines 14 and 23
  • DevExpress/testcafe-build-system/actions/build@main at line 16
  • DevExpress/testcafe-build-system/actions/test-npm@main at line 25

Because the error happens before your repo’s own test commands run, the fix is to update the shared action(s) so they no longer use actions/cache@v2.

Fix

Update the referenced composite/reusable actions in DevExpress/testcafe-build-system from:

uses: actions/cache@v2

to either:

uses: actions/cache@v4

or:

uses: actions/cache@v3

v4 is the better choice.

What to change

In the external action repo, look for actions/cache@v2 inside:

  • actions/prepare
  • actions/build
  • actions/test-npm

and replace it with actions/cache@v4.

Example:

- name: Cache npm
  uses: actions/cache@v4
  with:
    path: ~/.npm
    key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }}
    restore-keys: |
      ${{ runner.os }}-node-

Recommended repo-side change

Your workflow currently tracks @main, which means this repo can break whenever the shared action changes. In .github/workflows/test.yml, pin the shared actions to a commit or release tag after the cache fix is merged.

Example:

steps:
  - uses: DevExpress/testcafe-build-system/actions/prepare@<fixed-sha>
  - uses: DevExpress/testcafe-build-system/actions/build@<fixed-sha>

and

steps:
  - uses: DevExpress/testcafe-build-system/actions/prepare@<fixed-sha>
  - uses: DevExpress/testcafe-build-system/actions/test-npm@<fixed-sha>
    env:
      BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }}
      BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}
    with:
      task: test

Why this is the right fix

  • The log shows an infrastructure-level workflow failure, not an application or package failure.
  • package-lock.json is not the source of the error.
  • No failing source file or test assertion is referenced because execution never reached the test phase.

So the solution is: update the shared GitHub Action(s) to use actions/cache@v3 or @v4, then pin this workflow to the fixed revision instead of @main.

User: Can you create a PR in testcafe-build-system repo to fix this issue?

Assistant: I’ve started the PR creation workflow in DevExpress/testcafe-build-system; once it finishes, I’ll share the PR link and summary.

This pull request was created from Copilot chat.

Copilot AI changed the title [WIP] Fix deprecated GitHub Actions cache usage in shared build-system actions Update shared test action to remove deprecated cache v2 usage May 12, 2026
Copilot AI requested a review from aleks-pro May 12, 2026 13:34
@aleks-pro aleks-pro marked this pull request as ready for review May 12, 2026 13:40
@aleks-pro aleks-pro merged commit 0e413ed into main May 12, 2026
1 check passed
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.

2 participants