Skip to content

Commit 8f07c1a

Browse files
authored
Merge pull request #68 from apazzolini/pnpm-support
Add pnpm support
2 parents a13dc8d + b35f8d8 commit 8f07c1a

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed

index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/index.js

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ import { fileExists, diffTable, toBool, stripHash } from './utils.js';
88
/**
99
* @typedef {ReturnType<typeof import("@actions/github").getOctokit>} Octokit
1010
* @typedef {typeof import("@actions/github").context} ActionContext
11-
* @param {Octokit} octokit
12-
* @param {ActionContext} context
13-
* @param {string} token
11+
* @param {Octokit} octokit
12+
* @param {ActionContext} context
13+
* @param {string} token
1414
*/
1515
async function run(octokit, context, token) {
1616
const { owner, repo, number: pull_number } = context.issue;
@@ -51,13 +51,17 @@ async function run(octokit, context, token) {
5151
const cwd = process.cwd();
5252

5353
let yarnLock = await fileExists(path.resolve(cwd, 'yarn.lock'));
54+
let pnpmLock = await fileExists(path.resolve(cwd, 'pnpm-lock.yaml'));
5455
let packageLock = await fileExists(path.resolve(cwd, 'package-lock.json'));
5556

5657
let npm = `npm`;
5758
let installScript = `npm install`;
5859
if (yarnLock) {
5960
installScript = npm = `yarn --frozen-lockfile`;
6061
}
62+
else if (pnpmLock) {
63+
installScript = `pnpm install --frozen-lockfile`;
64+
}
6165
else if (packageLock) {
6266
installScript = `npm ci`;
6367
}
@@ -71,7 +75,7 @@ async function run(octokit, context, token) {
7175
console.log(`Building using ${npm} run ${buildScript}`);
7276
await exec(`${npm} run ${buildScript}`);
7377
endGroup();
74-
78+
7579
// In case the build step alters a JSON-file, ....
7680
await exec(`git reset --hard`);
7781

@@ -117,11 +121,15 @@ async function run(octokit, context, token) {
117121
startGroup(`[base] Install Dependencies`);
118122

119123
yarnLock = await fileExists(path.resolve(cwd, 'yarn.lock'));
124+
pnpmLock = await fileExists(path.resolve(cwd, 'pnpm-lock.yaml'));
120125
packageLock = await fileExists(path.resolve(cwd, 'package-lock.json'));
121-
126+
122127
if (yarnLock) {
123128
installScript = npm = `yarn --frozen-lockfile`;
124129
}
130+
else if (pnpmLock) {
131+
installScript = `pnpm install --frozen-lockfile`;
132+
}
125133
else if (packageLock) {
126134
installScript = `npm ci`;
127135
}
@@ -256,8 +264,8 @@ async function run(octokit, context, token) {
256264

257265
/**
258266
* Create a check and return a function that updates (completes) it
259-
* @param {Octokit} octokit
260-
* @param {ActionContext} context
267+
* @param {Octokit} octokit
268+
* @param {ActionContext} context
261269
*/
262270
async function createCheck(octokit, context) {
263271
const check = await octokit.checks.create({

0 commit comments

Comments
 (0)