git-contributor-stats
Version:
CLI to compute contributor and repository statistics from a Git repository (commits, lines added/deleted, frequency, heatmap, bus-factor), with filters and multiple output formats.
38 lines (36 loc) • 1.07 kB
JavaScript
import fs from "node:fs";
import path from "node:path";
import { e as ensureDir } from "../chunks/utils-CFufYn8A.mjs";
async function generateWorkflow(repo) {
const wfPath = path.join(repo, ".github", "workflows", "git-contributor-stats.yml");
ensureDir(path.dirname(wfPath));
const content = `name: Git Contributor Stats
on:
push:
branches: [main]
workflow_dispatch:
jobs:
report:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install deps
run: npm ci || npm i
- name: Run report
run: npx git-contributor-stats --out-dir=./reports --html=reports/report.html --json --charts
- name: Upload report
uses: actions/upload-artifact@v4
with:
name: git-contrib-report
path: reports
`;
fs.writeFileSync(wfPath, content, "utf8");
console.error(`Wrote sample GitHub Actions workflow to ${wfPath}`);
}
export {
generateWorkflow as g
};
//# sourceMappingURL=workflow.mjs.map