Compare commits

..

1 commit

Author SHA1 Message Date
renovate[bot]
64adb5542c
chore(deps): update actions/checkout action to v4 2024-01-23 09:11:09 +00:00
6 changed files with 10 additions and 50 deletions

View file

@ -10,10 +10,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v4
- name: Install yarn
run: npm i -g yarn
- name: Set up Node - name: Set up Node
uses: actions/setup-node@v3 uses: actions/setup-node@v3
@ -39,10 +36,7 @@ jobs:
node-version: [16, 18, 20] node-version: [16, 18, 20]
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v4
- name: Install yarn
run: npm i -g yarn
- name: Set up Node - name: Set up Node
uses: actions/setup-node@v3 uses: actions/setup-node@v3

View file

@ -11,7 +11,7 @@ jobs:
container: practically/conventional-tools:1.x@sha256:647d6e4b3edfcbac6054b90f74d2c61a022152751b94484d54e13695a9e27377 container: practically/conventional-tools:1.x@sha256:647d6e4b3edfcbac6054b90f74d2c61a022152751b94484d54e13695a9e27377
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v4
with: {fetch-depth: 1000} with: {fetch-depth: 1000}
- name: Git safe.directory - name: Git safe.directory

View file

@ -16,7 +16,7 @@ jobs:
CT_TOKEN: ${{ secrets.GITHUB_TOKEN }} CT_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v4
with: with:
fetch-depth: 0 fetch-depth: 0

View file

@ -11,7 +11,7 @@ jobs:
if: ${{ github.event.workflow_run.conclusion == 'success' }} if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v4
- name: Setup Node - name: Setup Node
uses: actions/setup-node@v3 uses: actions/setup-node@v3

View file

@ -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) => { export const run = async (argv = process.argv) => {
const parsed: Argv = await yargs(hideBin(argv)).options(options).argv; const parsed: Argv = await yargs(hideBin(argv)).options(options).argv;
const validationError = await validate(parsed); const validationError = await validate(parsed);
@ -96,12 +62,12 @@ export const run = async (argv = process.argv) => {
return lcovDiff(baseCoverage, compareCoverage); return lcovDiff(baseCoverage, compareCoverage);
} }
const diffText = await getDiff(); const diffText = await exec(`git diff origin/HEAD...HEAD`);
if (!diffText) { if (diffText.code > 0) {
return; 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); const { percentage } = report(diff, baseCoverage);
process.exit(percentage > 90 ? 0 : 1); process.exit(percentage > 90 ? 0 : 1);

View file

@ -1,7 +1,7 @@
const getCoverageForFile = (file: any, coverage: any) => { const getCoverageForFile = (file: any, coverage: any) => {
for (const cov of coverage) { for (const cov of coverage) {
const report: { [k: number]: number } = {}; const report: { [k: number]: number } = {};
if (cov.file.replace("./", "") === file.to) { if (cov.file === file.to) {
for (const detail of cov.lines.details) { for (const detail of cov.lines.details) {
report[detail.line] = detail.hit; report[detail.line] = detail.hit;
} }