Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
bonyuta0204 committed Nov 30, 2023
1 parent f931a42 commit f132577
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 1 deletion.
40 changes: 40 additions & 0 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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/", ""));
Expand Down Expand Up @@ -34463,6 +34495,14 @@ module.exports = require("fs");

/***/ }),

/***/ 3292:
/***/ ((module) => {

"use strict";
module.exports = require("fs/promises");

/***/ }),

/***/ 3685:
/***/ ((module) => {

Expand Down
12 changes: 11 additions & 1 deletion src/git-util.ts
Original file line number Diff line number Diff line change
@@ -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/", ""));
Expand Down

0 comments on commit f132577

Please sign in to comment.