Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ If `run_install` is a YAML string representation of either an object or an array

### `package_json_file`

**Optional** (_type:_ `string`, _default:_ `package.json`) File path to the `package.json`/[`package.yaml`](https://github.com/pnpm/pnpm/pull/1799) to read "packageManager" configuration.
**Optional** (_type:_ `string`, _default:_ `package.json`) File path to the `package.json`/[`package.yaml`](https://github.com/pnpm/pnpm/pull/1799)/`package.json5` to read "packageManager" configuration.

Comment on lines 53 to 56
Copy link

Copilot AI Apr 4, 2026

Choose a reason for hiding this comment

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

README documents package.json5 support here, but action.yml’s package_json_file input description still only mentions package.json. To keep the Marketplace/action docs consistent, please update action.yml to mention package.yaml and package.json5 as supported formats too.

Copilot uses AI. Check for mistakes.
### `standalone`

Expand Down
4 changes: 2 additions & 2 deletions dist/index.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"@types/node": "^20.11.5",
"@types/node-fetch": "^2.6.11",
"expand-tilde": "^2.0.2",
"json5": "^2.2.3",
"yaml": "^2.3.4",
"zod": "^3.22.4"
Comment on lines 14 to 19
Copy link

Copilot AI Apr 4, 2026

Choose a reason for hiding this comment

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

dist/index.js is the action entrypoint (action.yml), and the repo's PR workflow rebuilds and checks that dist/index.js is committed. Since this change adds a new runtime dependency (json5) and modifies parsing logic, you need to run pnpm run build and commit the updated dist/index.js; otherwise CI will fail and the published action won't include the change.

Copilot uses AI. Check for mistakes.
},
Expand Down
10 changes: 10 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion src/install-pnpm/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { execPath } from 'process'
import util from 'util'
import { Inputs } from '../inputs'
import YAML from 'yaml'
import JSON5 from 'json5'

export async function runSelfInstaller(inputs: Inputs): Promise<number> {
const { version, dest, packageJsonFile, standalone } = inputs
Expand Down Expand Up @@ -64,7 +65,7 @@ async function readTarget(opts: {
const content = readFileSync(path.join(GITHUB_WORKSPACE, packageJsonFile), 'utf8');
({ packageManager } = packageJsonFile.endsWith(".yaml")
? YAML.parse(content, { merge: true })
: JSON.parse(content)
: JSON5.parse(content)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

You should change the logic into the following:

  1. If the file name ends with .yaml, use YAML.
  2. If the file name ends with .json5, use JSON5.
  3. Otherwise, use JSON.

IIRC, pnpm only uses JSON5 for package.json5.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

@KSXGitHub
Thank you for the review.
Fixed in be2217e.

)
} catch (error: unknown) {
// Swallow error if package.json doesn't exist in root
Expand Down
Loading