Skip to content

Commit

Permalink
chore: support pnpm
Browse files Browse the repository at this point in the history
  • Loading branch information
kyledurand committed Apr 1, 2024
1 parent 25db6a3 commit 7a56ee8
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ try {
const {payload} = github.context;
const octokit = github.getOctokit(process.env.GITHUB_TOKEN);
const isYarn = existsSync('yarn.lock');
const isPnpm = existsSync('pnpm-lock.yaml');
const isNpm = existsSync('package-lock.json');

if (
!payload.comment ||
Expand Down Expand Up @@ -99,7 +101,11 @@ try {

if (isYarn) {
await exec('yarn', ['install', '--frozen-lockfile']);
} else {
}
if (isPnpm) {
await exec('pnpm', ['install']);
}
if (isNpm) {
await exec('npm', ['ci']);
}

Expand Down Expand Up @@ -142,6 +148,10 @@ try {
}

const multiple = newTags.length > 1;
let installMessage;
if (isYarn) installMessage = 'yarn add';
else if (isPnpm) installMessage = 'pnpm add --workspace-root';
else if (isNpm) installMessage = 'npm install';

await octokit.rest.issues.createComment({
...ownerRepo,
Expand All @@ -159,7 +169,7 @@ try {
.map(
(tag) =>
'```sh\n' +
`${isYarn ? 'yarn add' : 'npm install'} ${tag}\n` +
`${installMessage} ${tag}\n` +
'```',
)
.join('\n'),
Expand Down

0 comments on commit 7a56ee8

Please sign in to comment.