Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
301 changes: 146 additions & 155 deletions dist/index.js

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,8 @@
"@actions/core": "^3.0.1",
"@actions/exec": "^3.0.0",
"@actions/glob": "^0.7.0",
"@types/expand-tilde": "^2.0.2",
"@types/node": "^26.6.5",
"@types/semver": "^7.8.0",
"expand-tilde": "^2.0.2",
"get-pnpm": "^0.0.8",
"semver": "^7.8.5",
"yaml": "^2.9.1"
Expand Down
33 changes: 0 additions & 33 deletions pnpm-lock.yaml

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

22 changes: 21 additions & 1 deletion src/inputs/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { existsSync } from 'node:fs'
import os from 'node:os'
import path from 'node:path'

import { getBooleanInput, getInput, InputOptions } from '@actions/core'
import expandTilde from 'expand-tilde'

import { resolveRegistry } from '../install-pnpm/registry.js'

Expand Down Expand Up @@ -61,6 +61,26 @@ function parseRuntime (): RuntimeInput | undefined {

const MANIFEST_NAMES = ['package.json', 'package.yaml'] as const

/**
* Expands a leading tilde in a file path.
*
* @param inputPath The file path to expand.
* @returns The expanded path.
*/
function expandTilde (inputPath: string): string {
const home = os.homedir()

if (inputPath.startsWith('~+')) {
return path.join(process.cwd(), inputPath.slice(2))
}

if (inputPath.startsWith('~')) {
return home ? path.join(home, inputPath.slice(1)) : inputPath
}

return inputPath
}

/**
* `working-directory` says where the project is; `package-json-file` said
* which file to read. The second is deprecated onto the first, because the
Expand Down