I am trying to add github actions workflow in my application. This is a new laravel app with default workflow from github with modifications on caching npm and vendor. Based on the logs, I was able to cache the vendor but not the npm.
Folder Structure
|root
├───.github
│ └───workflows
│ └───laravel.yml
|───composer.lock
|───package-lock.json
laravel.yml
jobs:
development-merging:
runs-on: ubuntu-latest
steps:
- uses: shivammathur/setup-php@15c43e89cdef867065b0213be354c2841860869e
with:
php-version: "8.3"
# Cache node_modules
- name: Cache Node.js dependencies
uses: actions/setup-node@v4
with:
node-version: 20
cache: "npm"
cache-dependency-path: "**/package-lock.json"
# Cache vendor directory
- name: Cache PHP dependencies
uses: actions/cache@v4
with:
path: |
**/vendor
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
This results in error pointing to cache-dependency-path
Error: Some specified paths were not resolved, unable to cache dependencies.
The same with
cache-dependency-path: "package-lock.json"
and
cache-dependency-path: "/package-lock.json"
I tried others like
cache-dependency-path: ../../package-lock.json
Results with error
Error: Invalid pattern '../../package-lock.json'. Relative pathing '.' and '..' is not allowed.
Removing cache-dependency-path
the results with error
Error: Dependencies lock file is not found in /home/runner/work/appnamehere/appnamehere. Supported file patterns: package-lock.json,npm-shrinkwrap.json,yarn.lock
3