Skip to content

Commit

Permalink
Merge pull request #19593 from dannon/vuetsccheck
Browse files Browse the repository at this point in the history
Add vue-tsc baseline comparison to client-lint workflow
  • Loading branch information
mvdbeek authored Feb 12, 2025
2 parents 92a7cfa + 07e5639 commit a81c573
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/js_lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,45 @@ jobs:
- name: Run prettier checks
run: yarn run format-check
working-directory: client
# Run vue-tsc, compare with base, only fail if errors increased.
- name: Run vue-tsc on PR
id: current
working-directory: client
run: |
# Run vue-tsc in a simulated TTY to capture the summary output.
script -q -c 'npx vue-tsc --noEmit' current.log
# Extract the error count from the summary line; default to 0 if not found.
CURRENT_ERRORS=$(grep -oE 'Found [0-9]+ errors' current.log | head -1 | grep -oE '[0-9]+' || echo 0)
echo "Current vue-tsc errors: $CURRENT_ERRORS"
echo "current_errors=$CURRENT_ERRORS" >> $GITHUB_OUTPUT
# Check out the target base branch into a separate directory called "base".
- name: Checkout target base branch
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.base.ref }}
- run: yarn install --frozen-lockfile
working-directory: client
# Run vue-tsc on the base branch and capture its error count.
- name: Run vue-tsc on base branch
id: baseline
working-directory: client
run: |
# Run vue-tsc in a simulated TTY and save the output to baseline.log.
script -q -c 'npx vue-tsc --noEmit' baseline.log
# Extract the error count from the summary line; default to 0 if not found.
BASE_ERRORS=$(grep -oE 'Found [0-9]+ errors' baseline.log | head -1 | grep -oE '[0-9]+' || echo 0)
echo "Baseline vue-tsc errors: $BASE_ERRORS"
echo "baseline_errors=$BASE_ERRORS" >> $GITHUB_OUTPUT
# Compare the error counts between the PR branch and the base branch.
- name: Compare vue-tsc error counts
run: |
CURRENT=${{ steps.current.outputs.current_errors }}
BASE=${{ steps.baseline.outputs.baseline_errors }}
echo "Current errors: ${CURRENT}"
echo "Baseline errors: ${BASE}"
if [ "$CURRENT" -gt "$BASE" ]; then
echo "vue-tsc error count increased from ${BASE} to ${CURRENT}. Failing the build."
exit 1
else
echo "vue-tsc error count did not increase."
fi

0 comments on commit a81c573

Please sign in to comment.