Revises Markdown Pages and Reports #8572
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Client linting | |
on: | |
push: | |
paths: | |
- 'client/**' | |
- '.github/workflows/js_lint.yaml' | |
pull_request: | |
paths: | |
- 'client/**' | |
- '.github/workflows/js_lint.yaml' | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
client-unit-test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node: [18] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node}} | |
cache: 'yarn' | |
cache-dependency-path: 'client/yarn.lock' | |
- run: yarn install --frozen-lockfile | |
working-directory: client | |
- name: Run ESLint | |
run: yarn run eslint | |
working-directory: client | |
- 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 |