diff --git a/dist/index.js b/dist/index.js index e8d42a4..ac474df 100644 --- a/dist/index.js +++ b/dist/index.js @@ -34355,15 +34355,47 @@ function wrappy (fn, cb) { "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.hasCommitsBetween = exports.fetchRemoteBranches = void 0; const core_1 = __nccwpck_require__(9093); +const promises_1 = __nccwpck_require__(3292); +const path = __importStar(__nccwpck_require__(1017)); const simple_git_1 = __importDefault(__nccwpck_require__(791)); const git = (0, simple_git_1.default)(); +async function listGitDirectory() { + const dir = ".git"; + const files = await (0, promises_1.readdir)(dir); + return files.map((file) => path.join(dir, file)); +} async function fetchRemoteBranches() { + const files = await listGitDirectory(); + (0, core_1.info)(files.join("\n")); await git.fetch(["--unshallow"]); const branches = await git.branch(["-r"]); return branches.all.map((branch) => branch.replace("origin/", "")); @@ -34463,6 +34495,14 @@ module.exports = require("fs"); /***/ }), +/***/ 3292: +/***/ ((module) => { + +"use strict"; +module.exports = require("fs/promises"); + +/***/ }), + /***/ 3685: /***/ ((module) => { diff --git a/src/git-util.ts b/src/git-util.ts index 0783f1d..77b10e8 100644 --- a/src/git-util.ts +++ b/src/git-util.ts @@ -1,9 +1,19 @@ -import { debug } from "@actions/core"; +import { debug, info } from "@actions/core"; +import { readdir } from "fs/promises"; +import * as path from "path"; import simpleGit from "simple-git"; const git = simpleGit(); +async function listGitDirectory() { + const dir = ".git"; + const files = await readdir(dir); + return files.map((file) => path.join(dir, file)); +} + export async function fetchRemoteBranches() { + const files = await listGitDirectory(); + info(files.join("\n")); await git.fetch(["--unshallow"]); const branches = await git.branch(["-r"]); return branches.all.map((branch) => branch.replace("origin/", ""));