Skip to content

Update eslint monorepo to v9.34.0 (minor) #20

Update eslint monorepo to v9.34.0 (minor)

Update eslint monorepo to v9.34.0 (minor) #20

Workflow file for this run

name: Lint
on:
pull_request:
types: [ opened, synchronize, reopened ]
permissions: { }
env:
CI: 'true'
DO_NOT_TRACK: '1'
NEXT_TELEMETRY_DISABLED: '1'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
jobs:
lint:
name: Lint app
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- name: Checkout repository
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
- name: Setup pnpm
uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4
with:
run_install: false
- name: Setup Node.js
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version-file: .node-version
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --frozen-lockfile
- uses: oxc-project/oxlint-action@d77e44ee001f4d94c4191fdb03af8be0c98f3d35 # v2.0.1
with:
config: .oxlintrc.json
- name: Run lint and capture output
id: lint
shell: bash
run: |
set -o pipefail
pnpm run lint 2>&1 | tee lint-output.txt
echo "exit_code=${PIPESTATUS[0]}" >> $GITHUB_OUTPUT
continue-on-error: true
- name: Comment lint results on PR
if: ${{ !cancelled() }}
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7
with:
script: |
const fs = require('fs');
const output = fs.readFileSync('lint-output.txt', 'utf8');
const exitCode = '${{ steps.lint.outputs.exit_code }}';
const title = exitCode === '0' ? '✅ Lint passed' : '❌ Lint found issues';
const marker = '<!-- lint-report:adev-nextjs-blog -->';
const body = `${marker}\n### ${title}\n\n<details><summary>Show output</summary>\n\n\`\`\`\n${output.slice(-60000)}\n\`\`\`\n\n</details>`;
const { owner, repo } = context.repo;
const issue_number = context.issue.number;
if (!issue_number) {
core.info('No pull request context detected, skipping comment.');
} else {
// Find existing comment with the marker and update it; otherwise create a new one
const comments = await github.paginate(github.rest.issues.listComments, {
owner,
repo,
issue_number,
per_page: 100,
});
const existing = comments.find(c => typeof c.body === 'string' && c.body.includes(marker));
if (existing) {
await github.rest.issues.updateComment({ owner, repo, comment_id: existing.id, body });
} else {
await github.rest.issues.createComment({ owner, repo, issue_number, body });
}
}
- name: Fail if lint failed
if: steps.lint.outputs.exit_code != '0' && !cancelled()
run: exit ${{ steps.lint.outputs.exit_code }}
- name: Build
run: pnpm run build --no-lint
env:
SKIP_T3_ENV_VALIDATION: 'true'