Skip to content

Commit ea1a8c6

Browse files
committed
chore: update workflow actions
1 parent 882f489 commit ea1a8c6

2 files changed

Lines changed: 73 additions & 53 deletions

File tree

.github/workflows/default.yml

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3,56 +3,58 @@ name: CI
33
on:
44
push:
55
branches:
6-
- main
6+
- main
77
paths:
8-
- '.github/**'
9-
- 'config/**'
10-
- 'images/**'
11-
- 'snippets/**'
12-
- 'src/**'
13-
- 'syntaxes/**'
14-
- 'package.json'
15-
- 'pnpm-lock.yaml'
8+
- ".github/workflows/**"
9+
- "config/**"
10+
- "images/**"
11+
- "snippets/**"
12+
- "src/**"
13+
- "syntaxes/**"
14+
- "package.json"
15+
- "pnpm-lock.yaml"
1616
pull_request:
1717
branches:
18-
- main
18+
- main
1919
paths:
20-
- '.github/**'
21-
- 'config/**'
22-
- 'images/**'
23-
- 'snippets/**'
24-
- 'src/**'
25-
- 'syntaxes/**'
26-
- 'package.json'
27-
- 'pnpm-lock.yaml'
20+
- ".github/workflows/**"
21+
- "config/**"
22+
- "images/**"
23+
- "snippets/**"
24+
- "src/**"
25+
- "syntaxes/**"
26+
- "package.json"
27+
- "pnpm-lock.yaml"
2828
workflow_dispatch:
2929

3030
jobs:
3131
default:
3232
runs-on: ${{ matrix.os }}
3333
strategy:
3434
matrix:
35-
node-version: ['lts/*', '*']
35+
node-version: ["lts/*", "*"]
3636
os: [ubuntu-latest]
3737

3838
steps:
39-
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
39+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
4040
with:
4141
fetch-depth: 1
4242

43-
- uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1
43+
- uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4.0.3
4444
with:
4545
node-version: ${{ matrix.node-version }}
4646

4747
- name: Enable Corepack
48-
run: corepack enable
48+
run: |
49+
npm install --global corepack@latest
50+
corepack enable
4951
5052
- name: Get pnpm store directory
5153
shell: bash
5254
run: |
5355
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
5456
55-
- uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0
57+
- uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf # v4.2.2
5658
name: Setup pnpm cache
5759
with:
5860
path: ${{ env.STORE_PATH }}
@@ -71,4 +73,3 @@ jobs:
7173

7274
- name: Run Tests
7375
run: pnpm run --if-present test
74-

src/util.ts

Lines changed: 48 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,35 @@
11
// Dependencies
2-
import { constants, promises as fs } from 'fs';
3-
import { getConfig } from 'vscode-get-config';
4-
import { join } from 'path';
5-
import { platform } from 'os';
6-
import { spawn } from 'child_process';
7-
import { window, type OutputChannel } from 'vscode';
8-
import open from 'open';
2+
import { constants, promises as fs } from "fs";
3+
import { getConfig } from "vscode-get-config";
4+
import { join } from "path";
5+
import { platform } from "os";
6+
import { spawn } from "child_process";
7+
import { window, type OutputChannel } from "vscode";
8+
import open from "open";
99

1010
async function clearOutput(channel: OutputChannel): Promise<void> {
11-
const { alwaysShowOutput } = await getConfig('pynsist');
11+
const { alwaysShowOutput } = await getConfig("pynsist");
1212

1313
channel.clear();
1414
if (alwaysShowOutput === true) {
1515
channel.show(true);
1616
}
1717
}
1818

19-
async function detectOutput(relativePath: string, line: string, needle: DetectOutputOptions): Promise<string> {
19+
async function detectOutput(
20+
relativePath: string,
21+
line: string,
22+
needle: DetectOutputOptions,
23+
): Promise<string> {
2024
if (line.includes(needle.string)) {
2125
const regex = needle.regex;
2226
const result = regex.exec(line.toString());
2327
const absolutePath = join(relativePath, result[1]);
2428

25-
return (await fileExists(absolutePath)) ? absolutePath : '';
29+
return (await fileExists(absolutePath)) ? absolutePath : "";
2630
}
2731

28-
return '';
32+
return "";
2933
}
3034

3135
async function fileExists(filePath: string): Promise<boolean> {
@@ -39,30 +43,32 @@ async function fileExists(filePath: string): Promise<boolean> {
3943
}
4044

4145
function getPrefix(): string {
42-
return platform() === 'win32' ? '/' : '-';
46+
return platform() === "win32" ? "/" : "-";
4347
}
4448

4549
async function getPath(): Promise<string | number> {
46-
const pathToPynsist = (await getConfig('pynsist.pathToPynsist')) || 'pynsist';
50+
const pathToPynsist = (await getConfig("pynsist.pathToPynsist")) || "pynsist";
4751

4852
return new Promise((resolve, reject) => {
4953
if (pathToPynsist) {
50-
console.log('Using pynsist path found in user settings: ' + pathToPynsist);
54+
console.log(
55+
"Using pynsist path found in user settings: " + pathToPynsist,
56+
);
5157
return resolve(pathToPynsist);
5258
}
5359

54-
const which = spawn(this.which(), ['pynsist']);
60+
const which = spawn(this.which(), ["pynsist"]);
5561

56-
which.stdout.on('data', (data) => {
57-
console.log('Using pynsist path detected on file system: ' + data);
62+
which.stdout.on("data", (data) => {
63+
console.log("Using pynsist path detected on file system: " + data);
5864
return resolve(data);
5965
});
6066

61-
which.on('error', (errorMessage) => {
67+
which.on("error", (errorMessage) => {
6268
console.error({ errorMessage: errorMessage });
6369
});
6470

65-
which.on('close', (code) => {
71+
which.on("close", (code) => {
6672
if (code !== 0) {
6773
return reject(code);
6874
}
@@ -72,28 +78,32 @@ async function getPath(): Promise<string | number> {
7278

7379
function pathWarning(): void {
7480
window
75-
.showWarningMessage('pynsist is not installed or missing in your PATH environment variable', 'Download', 'Help')
81+
.showWarningMessage(
82+
"pynsist is not installed or missing in your PATH environment variable",
83+
"Download",
84+
"Help",
85+
)
7686
.then((choice) => {
7787
switch (choice) {
78-
case 'Download':
79-
open('https://pypi.python.org/pypi/pynsist');
88+
case "Download":
89+
open("https://pypi.python.org/pypi/pynsist");
8090
break;
8191

82-
case 'Help':
83-
open('http://superuser.com/a/284351/195953');
92+
case "Help":
93+
open("http://superuser.com/a/284351/195953");
8494
break;
8595
}
8696
});
8797
}
8898

8999
async function runInstaller(outFile: string): Promise<void> {
90-
const { useWineToRun } = getConfig('pynsist');
100+
const { useWineToRun } = getConfig("pynsist");
91101

92-
if (platform() === 'win32') {
102+
if (platform() === "win32") {
93103
// Setting shell to true seems to prevent spawn UNKNOWN errors
94104
spawn(outFile, [], { shell: true });
95105
} else if (useWineToRun === true) {
96-
spawn('wine', [outFile]);
106+
spawn("wine", [outFile]);
97107
}
98108
}
99109

@@ -102,7 +112,16 @@ function sanitize(response: unknown): string {
102112
}
103113

104114
function which(): string {
105-
return platform() === 'win32' ? 'where' : 'which';
115+
return platform() === "win32" ? "where" : "which";
106116
}
107117

108-
export { clearOutput, detectOutput, getPrefix, getPath, pathWarning, runInstaller, sanitize, which };
118+
export {
119+
clearOutput,
120+
detectOutput,
121+
getPrefix,
122+
getPath,
123+
pathWarning,
124+
runInstaller,
125+
sanitize,
126+
which,
127+
};

0 commit comments

Comments
 (0)