Skip to content

GH-641: Fix Known CI Issues#658

Open
Infinite-Null wants to merge 16 commits intotheme-elementary-v2from
fix/ci-known-issues
Open

GH-641: Fix Known CI Issues#658
Infinite-Null wants to merge 16 commits intotheme-elementary-v2from
fix/ci-known-issues

Conversation

@Infinite-Null
Copy link
Copy Markdown
Member

@Infinite-Null Infinite-Null commented Apr 1, 2026

Description

Resolves multiple issues in the CI workflow that were causing incorrect behavior and deprecation warnings.
Fixes: #641

Technical Details

  • Replaced all deprecated ::set-output usages with the recommended $GITHUB_OUTPUT approach to ensure compatibility with current GitHub Actions standards.

  • Eliminated hard-coded "CK theme" references in log messages. These have been replaced with dynamic values using ${{ github.event.repository.name }}, improving reusability across repositories.

  • Corrected the logic of the Notice step in the unit-test-php job. Previously, it executed when PHP files were modified; it now correctly runs only when no PHP changes are detected.

  • Introduced dependency caching for node_modules using actions/cache@v5.0.3

    The cache key is composed of:

    • OS
    • package-lock.json hash
    • Node version

Checklist

  • Deprecated ::set-output syntax → replaced with $GITHUB_OUTPUT
  • Hard-coded client name ("CK theme") → replaced with dynamic repository name
  • Incorrect conditional logic in Notice step → fixed execution condition
  • Missing npm dependency caching → added actions/cache for node_modules

Screenshots

image Screenshot 2026-04-01 at 7 14 17 PM

@aryanjasala aryanjasala changed the base branch from main to theme-elementary-v2 April 2, 2026 08:31
Comment on lines +103 to +113
- name: Get node version
id: node
run: echo "version=$(node -v)" >> $GITHUB_OUTPUT

- name: Cache node_modules
id: node_modules
uses: actions/cache@v5.0.3
with:
path: '**/node_modules'
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/package-lock.json') }}-${{ steps.node.outputs.version }}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is being added multiple times in the file, can this be converted to an action and re-used everywhere?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

uses: actions/cache@v5.0.3
with:
path: '**/node_modules'
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/package-lock.json') }}-${{ steps.node.outputs.version }}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The hashing should also depend on npmrc

key: ${{ runner.os }}-node-modules-${{ hashFiles('**/package-lock.json') }}-${{ steps.node.outputs.version }}

- name: Install Node dependencies
if: needs.pre-run.outputs.changed-php-count > 0 && steps.node_modules.outputs.cache-hit != 'true'
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why are node dependencies dependent on needs.pre-run.outputs.changed-php-count?

Copy link
Copy Markdown
Member Author

@Infinite-Null Infinite-Null Apr 3, 2026

Choose a reason for hiding this comment

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

The condition needs.pre-run.outputs.changed-php-count > 0 is added to avoid unnecessary Node installation when PHP tests are not required.

In this workflow, the unit-test-php job cannot be skipped entirely due to required status checks, so it still runs even when no PHP files are changed. Because of that, without this condition:

The cache step would still execute
And on a cache miss, npm ci would run
This would install Node dependencies even though PHP tests are not needed

So the condition ensures that Node-related setup (cache + install) only runs when PHP files have actually changed, preventing unnecessary installs caused by cache misses in irrelevant runs.

As per the latest change, this has been removed.

key: ${{ runner.os }}-node-modules-${{ hashFiles('**/package-lock.json') }}-${{ steps.node.outputs.version }}

- name: Install Node dependencies
if: needs.pre-run.outputs.changed-php-count > 0 && steps.node_modules.outputs.cache-hit != 'true'
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Convert steps.node_modules.outputs.cache-hit != 'true' to a variable and re-use

SHOULD_INSTALL: ${{ steps.node_modules.outputs.cache-hit != 'true' }}

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.

Fix Known CI Issues

2 participants