From 356a846c9882a0f5b2ece7c1884022e93ee82faf Mon Sep 17 00:00:00 2001 From: Brandon Chinn Date: Mon, 3 Jul 2023 15:28:33 -0700 Subject: [PATCH 1/6] Fix husky installation --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 9c6214d..cd885b9 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "scripts": { "bundle": "ncc build src/main.ts && tsc -p tsconfig-lib.json", "test": "jest", - "prepare": "cd .. && husky install setup/.husky", + "prepare": "husky install ./.husky/", "yolo-upgrade": "npx npm-check-updates -u && npm install" }, "repository": { From 95e6e1593b235bad271ad4327c5f985a2ccd3003 Mon Sep 17 00:00:00 2001 From: Brandon Chinn Date: Tue, 11 Jul 2023 18:42:46 -0700 Subject: [PATCH 2/6] Document pre-requisites --- docs/contributors.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/contributors.md b/docs/contributors.md index 73c6a1b..4b111f1 100644 --- a/docs/contributors.md +++ b/docs/contributors.md @@ -1,5 +1,10 @@ # Contributors +### Pre-requisites + +- Node.js v16 +- NPM + ### Checkin - Do checkin source (`src/`) From 6fcc3af7ce0c5d271a7f808b62471f6ffb0c8fff Mon Sep 17 00:00:00 2001 From: Brandon Chinn Date: Tue, 11 Jul 2023 19:00:14 -0700 Subject: [PATCH 3/6] Rebuild dist/index.js from fresh dist/index.js seems to have extra code from the main branch of @actions/io. This commit rebuilds dist/index.js with the version of @actions/io in package-lock.json --- dist/index.js | 74 +++++++++++++-------------------------------------- 1 file changed, 19 insertions(+), 55 deletions(-) diff --git a/dist/index.js b/dist/index.js index 4461716..3611f1c 100644 --- a/dist/index.js +++ b/dist/index.js @@ -4370,11 +4370,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }; var _a; Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.getCmdPath = exports.tryGetExecutablePath = exports.isRooted = exports.isDirectory = exports.exists = exports.IS_WINDOWS = exports.unlink = exports.symlink = exports.stat = exports.rmdir = exports.rename = exports.readlink = exports.readdir = exports.mkdir = exports.lstat = exports.copyFile = exports.chmod = void 0; +exports.getCmdPath = exports.tryGetExecutablePath = exports.isRooted = exports.isDirectory = exports.exists = exports.READONLY = exports.UV_FS_O_EXLOCK = exports.IS_WINDOWS = exports.unlink = exports.symlink = exports.stat = exports.rmdir = exports.rm = exports.rename = exports.readlink = exports.readdir = exports.open = exports.mkdir = exports.lstat = exports.copyFile = exports.chmod = void 0; const fs = __importStar(__nccwpck_require__(7147)); const path = __importStar(__nccwpck_require__(1017)); -_a = fs.promises, exports.chmod = _a.chmod, exports.copyFile = _a.copyFile, exports.lstat = _a.lstat, exports.mkdir = _a.mkdir, exports.readdir = _a.readdir, exports.readlink = _a.readlink, exports.rename = _a.rename, exports.rmdir = _a.rmdir, exports.stat = _a.stat, exports.symlink = _a.symlink, exports.unlink = _a.unlink; +_a = fs.promises +// export const {open} = 'fs' +, exports.chmod = _a.chmod, exports.copyFile = _a.copyFile, exports.lstat = _a.lstat, exports.mkdir = _a.mkdir, exports.open = _a.open, exports.readdir = _a.readdir, exports.readlink = _a.readlink, exports.rename = _a.rename, exports.rm = _a.rm, exports.rmdir = _a.rmdir, exports.stat = _a.stat, exports.symlink = _a.symlink, exports.unlink = _a.unlink; +// export const {open} = 'fs' exports.IS_WINDOWS = process.platform === 'win32'; +// See https://github.com/nodejs/node/blob/d0153aee367422d0858105abec186da4dff0a0c5/deps/uv/include/uv/win.h#L691 +exports.UV_FS_O_EXLOCK = 0x10000000; +exports.READONLY = fs.constants.O_RDONLY; function exists(fsPath) { return __awaiter(this, void 0, void 0, function* () { try { @@ -4555,12 +4561,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge Object.defineProperty(exports, "__esModule", ({ value: true })); exports.findInPath = exports.which = exports.mkdirP = exports.rmRF = exports.mv = exports.cp = void 0; const assert_1 = __nccwpck_require__(9491); -const childProcess = __importStar(__nccwpck_require__(2081)); const path = __importStar(__nccwpck_require__(1017)); -const util_1 = __nccwpck_require__(3837); const ioUtil = __importStar(__nccwpck_require__(1962)); -const exec = util_1.promisify(childProcess.exec); -const execFile = util_1.promisify(childProcess.execFile); /** * Copies a file or folder. * Based off of shelljs - https://github.com/shelljs/shelljs/blob/9237f66c52e5daa40458f94f9565e18e8132f5a6/src/cp.js @@ -4641,61 +4643,23 @@ exports.mv = mv; function rmRF(inputPath) { return __awaiter(this, void 0, void 0, function* () { if (ioUtil.IS_WINDOWS) { - // Node doesn't provide a delete operation, only an unlink function. This means that if the file is being used by another - // program (e.g. antivirus), it won't be deleted. To address this, we shell out the work to rd/del. // Check for invalid characters // https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file if (/[*"<>|]/.test(inputPath)) { throw new Error('File path must not contain `*`, `"`, `<`, `>` or `|` on Windows'); } - try { - const cmdPath = ioUtil.getCmdPath(); - if (yield ioUtil.isDirectory(inputPath, true)) { - yield exec(`${cmdPath} /s /c "rd /s /q "%inputPath%""`, { - env: { inputPath } - }); - } - else { - yield exec(`${cmdPath} /s /c "del /f /a "%inputPath%""`, { - env: { inputPath } - }); - } - } - catch (err) { - // if you try to delete a file that doesn't exist, desired result is achieved - // other errors are valid - if (err.code !== 'ENOENT') - throw err; - } - // Shelling out fails to remove a symlink folder with missing source, this unlink catches that - try { - yield ioUtil.unlink(inputPath); - } - catch (err) { - // if you try to delete a file that doesn't exist, desired result is achieved - // other errors are valid - if (err.code !== 'ENOENT') - throw err; - } } - else { - let isDir = false; - try { - isDir = yield ioUtil.isDirectory(inputPath); - } - catch (err) { - // if you try to delete a file that doesn't exist, desired result is achieved - // other errors are valid - if (err.code !== 'ENOENT') - throw err; - return; - } - if (isDir) { - yield execFile(`rm`, [`-rf`, `${inputPath}`]); - } - else { - yield ioUtil.unlink(inputPath); - } + try { + // note if path does not exist, error is silent + yield ioUtil.rm(inputPath, { + force: true, + maxRetries: 3, + recursive: true, + retryDelay: 300 + }); + } + catch (err) { + throw new Error(`File was unable to be removed ${err}`); } }); } From 906b3bf78367868c0922be04809e68a7ef7eb477 Mon Sep 17 00:00:00 2001 From: Brandon Chinn Date: Wed, 12 Jul 2023 20:17:35 -0700 Subject: [PATCH 4/6] Ensure generated files are up to date in CI --- .github/workflows/workflow.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index 9a32d34..8a2b1f7 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -31,6 +31,8 @@ jobs: - run: npm ci --prefer-offline --no-audit --progress=false - run: npm run bundle - run: npm test + - name: Ensure generated files are up-to-date + run: git diff --exit-code dist/ lib/ install-haskell: name: GHC ${{ matrix.plan.ghc }}, Cabal ${{ matrix.plan.cabal }} - ${{ matrix.os }} From 7646d75d5440b232acfb23f6b5e9a87889161f9c Mon Sep 17 00:00:00 2001 From: Brandon Chinn Date: Thu, 13 Jul 2023 09:18:28 -0700 Subject: [PATCH 5/6] Add .gitattributes --- .gitattributes | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..8b7fe53 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +dist/**/* linguist-generated=true +lib/**/* linguist-generated=true From ef752630eb03c3259a3adbca2a80da26da5cdcd7 Mon Sep 17 00:00:00 2001 From: Brandon Chinn Date: Thu, 13 Jul 2023 20:10:55 -0700 Subject: [PATCH 6/6] Fix references to haskell/actions --- __tests__/find-haskell.test.ts | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/__tests__/find-haskell.test.ts b/__tests__/find-haskell.test.ts index 5aaa396..a57fdf2 100644 --- a/__tests__/find-haskell.test.ts +++ b/__tests__/find-haskell.test.ts @@ -24,7 +24,7 @@ const forAllOS = (fn: (t: OS) => any) => const forAllTools = (fn: (t: Tool) => any) => (['ghc', 'cabal', 'stack'] as const).forEach(fn); -describe('haskell/actions/setup', () => { +describe('haskell-actions/setup', () => { it('Parses action.yml to get correct default versions', () => { forAllOS(os => forAllTools(t => diff --git a/package.json b/package.json index cd885b9..9333ce9 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ }, "repository": { "type": "git", - "url": "git+https://github.com/haskell/actions.git" + "url": "git+https://github.com/haskell-actions/setup.git" }, "keywords": [ "actions",