Compare commits
1 commit
0.x
...
renovate/a
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
64adb5542c |
6 changed files with 10 additions and 50 deletions
10
.github/workflows/ci.yml
vendored
10
.github/workflows/ci.yml
vendored
|
|
@ -10,10 +10,7 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Install yarn
|
||||
run: npm i -g yarn
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Node
|
||||
uses: actions/setup-node@v3
|
||||
|
|
@ -39,10 +36,7 @@ jobs:
|
|||
node-version: [16, 18, 20]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Install yarn
|
||||
run: npm i -g yarn
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Node
|
||||
uses: actions/setup-node@v3
|
||||
|
|
|
|||
2
.github/workflows/ct-commitlint.yml
vendored
2
.github/workflows/ct-commitlint.yml
vendored
|
|
@ -11,7 +11,7 @@ jobs:
|
|||
container: practically/conventional-tools:1.x@sha256:647d6e4b3edfcbac6054b90f74d2c61a022152751b94484d54e13695a9e27377
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
with: {fetch-depth: 1000}
|
||||
|
||||
- name: Git safe.directory
|
||||
|
|
|
|||
2
.github/workflows/ct-release.yml
vendored
2
.github/workflows/ct-release.yml
vendored
|
|
@ -16,7 +16,7 @@ jobs:
|
|||
CT_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
|
|
|
|||
2
.github/workflows/publish-release.yml
vendored
2
.github/workflows/publish-release.yml
vendored
|
|
@ -11,7 +11,7 @@ jobs:
|
|||
if: ${{ github.event.workflow_run.conclusion == 'success' }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v3
|
||||
|
|
|
|||
42
src/index.ts
42
src/index.ts
|
|
@ -48,40 +48,6 @@ export const validate = async (argv: Argv) => {
|
|||
}
|
||||
};
|
||||
|
||||
async function isGitRepo() {
|
||||
const isGit = await exec(`git rev-parse --is-inside-work-tree`);
|
||||
return isGit.code === 0;
|
||||
}
|
||||
|
||||
async function isSaplingRepo() {
|
||||
const isSapling = await exec(`sl root`);
|
||||
return isSapling.code === 0;
|
||||
}
|
||||
|
||||
async function getDiff(): Promise<string | undefined> {
|
||||
if (await isGitRepo()) {
|
||||
const diffText = await exec(`git diff origin/HEAD...HEAD`);
|
||||
if (diffText.code > 0) {
|
||||
error("Error loading the diff\n\n" + diffText.stderr);
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return diffText.stdout;
|
||||
}
|
||||
|
||||
if (await isSaplingRepo()) {
|
||||
const diffText = await exec(`sl diff -g -r '. % public()'`);
|
||||
if (diffText.code > 0) {
|
||||
error("Error loading the diff\n\n" + diffText.stderr);
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return diffText.stdout;
|
||||
}
|
||||
|
||||
error("Unable to get a diff no repo was found\n");
|
||||
}
|
||||
|
||||
export const run = async (argv = process.argv) => {
|
||||
const parsed: Argv = await yargs(hideBin(argv)).options(options).argv;
|
||||
const validationError = await validate(parsed);
|
||||
|
|
@ -96,12 +62,12 @@ export const run = async (argv = process.argv) => {
|
|||
return lcovDiff(baseCoverage, compareCoverage);
|
||||
}
|
||||
|
||||
const diffText = await getDiff();
|
||||
if (!diffText) {
|
||||
return;
|
||||
const diffText = await exec(`git diff origin/HEAD...HEAD`);
|
||||
if (diffText.code > 0) {
|
||||
return error("Error loading the diff\n\n" + diffText.stderr);
|
||||
}
|
||||
|
||||
const diff = parseDiff.default(diffText);
|
||||
const diff = parseDiff.default(diffText.stdout);
|
||||
|
||||
const { percentage } = report(diff, baseCoverage);
|
||||
process.exit(percentage > 90 ? 0 : 1);
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
const getCoverageForFile = (file: any, coverage: any) => {
|
||||
for (const cov of coverage) {
|
||||
const report: { [k: number]: number } = {};
|
||||
if (cov.file.replace("./", "") === file.to) {
|
||||
if (cov.file === file.to) {
|
||||
for (const detail of cov.lines.details) {
|
||||
report[detail.line] = detail.hit;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue