package.json within a subdirectory could not be found
Hello,
I have an issue with your action where it is not detecting the package.json within a subdirectory, e.g. backend/package.json.
Here is the action in question:
name: "Backend: Build"
on:
workflow_call:
jobs:
build:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
working-directory: backend ### Note this
outputs:
store-path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: true
- name: List all files in the working directory
run: ls -la
- name: Calculate the new version
id: version
uses: phips28/gh-action-bump-version@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
target-branch: main
skip-commit: 'true'
skip-tag: 'true'
skip-push: 'true'
tag-prefix: 'backend-'
The file backend/package.json does exist, the ls -la step outputs this:
>Run ls -la
total 148
drwxr-xr-x 5 runner docker 4096 Nov 2 11:40 .
drwxr-xr-x 7 runner docker 4096 Nov 2 11:40 ..
-rw-r--r-- 1 runner docker 771 Nov 2 11:40 package.json
-rw-r--r-- 1 runner docker 68455 Nov 2 11:40 pnpm-lock.yaml
I have tried supplying PACAKGEJSON_DIR: backend in the with as suggested by your documentation. It would be nice to know what directory it is checking in the error output to avoid confusion, as I've tried both with and without PACKAGEJSON_DIR and I have no idea which directory it's actually checking.
use PACKAGEJSON_DIR as env.
this happens to us as well sending PACKAGEJSON_DIR as env and all does not detect package.json
Hello all.
use
PACKAGEJSON_DIRas env.
I having that issue as well i've tried that it seems to work but i'am new to this whole automated version bump, so i fail to understand where this location is and how to point where this file is located, or how do one go about understanding this package.json life cycle would help a lot already. for example is that location locally on my machine or is that remotely.
hear is what i got.
name: 'My Custom Automated Version Bump'
# bump-policy:
# 'all' (default): checks all commit messages and skips bump if any previous bumps found
# 'ignore': always bump regardless of whether bumps included in commit messages
# 'last-commit': bump if last commit was not version bump
on:
push:
branches:
- 'main'
- 'releases/**'
jobs:
publish:
name: Create GitHub Release
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v3
- name: 'Automated Version Bump'
uses: 'phips28/gh-action-bump-version@master'
env:
PACKAGEJSON_DIR: './'
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
minor-wording: 'add,Adds,minor,Minor,new,New,feat,Feat,feature,Feature,release,Release'
major-wording: 'major,Major,breaking,Breaking'
patch-wording: 'patch,Patch,fix,Fix,fixes,Fixes' # Providing patch-wording will override commits
rc-wording: 'RELEASE,alpha,rc,pre,Beta,beta'
default: prerelease # default: patch
# tag-prefix: 'v'
# tag-suffix: '-beta'
# skip-tag: 'true'
# skip-commit: 'true' # Must be used in combination with skip-tag, since if there's no commit, there's nothing to tag.
# skip-push: 'true'
target-branch: 'main' # Useful in cases such as updating the version on master after a tag has been set
commit-message: 'CI: bumps version to {{version}} [skip ci]' # Useful for skipping additional workflows run on push.
bump-policy: 'last-commit' # Useful for pull requests between branches with version bumps.
# check-last-commit-only: 'true'
so please assistance would be greatly appreciated.. and thank you.
sorry thats a mess. i have never commented on github and dont know markdown/html that not my thing..
sorry thats a mess. i have never commented on github and dont know markdown/html that not my thing..
@lefty52 Wrap the code in three backticks (`)
e.g.
your code
Awesome Stuff thanks a lot for that.
@lefty52 the final path to your package dir is logged like this:
console.log('process.env.GITHUB_WORKSPACE', process.env.GITHUB_WORKSPACE);
@lefty52 the final path to your package dir is logged like this:
console.log('process.env.GITHUB_WORKSPACE', process.env.GITHUB_WORKSPACE);
Thank you so much for the response.
that helped a lot in understanding this.