Files
auth0__agent-skills/.github/workflows/claudelint.yml
Frederik Prijck a4f13da587 chore: add claudelint (#31)
* chore: add claudelint

* Resolve linter issues

* Address review comments
2026-04-02 13:34:46 +02:00

103 lines
3.6 KiB
YAML

name: claudelint
on:
pull_request:
branches: [main]
push:
branches: [main]
concurrency:
group: claudelint-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
permissions:
contents: read
pull-requests: write
jobs:
lint:
runs-on: ubuntu-latest
timeout-minutes: 10
env:
UV_PYTHON: "3.12"
CLAUDELINT_VERSION: "0.3.6"
steps:
- name: Checkout
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
- name: Install uv
uses: astral-sh/setup-uv@85856786d1ce8acfbcc2f13a5f3fbd6b938f9f41 # v7.1.2
with:
python-version: ${{ env.UV_PYTHON }}
- name: Cache uv tool env
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
with:
path: ~/.cache/uv
key: uv-${{ runner.os }}-py${{ env.UV_PYTHON }}-claudelint-${{ env.CLAUDELINT_VERSION }}
- name: Run claudelint in strict mode
id: claudelint
continue-on-error: true
run: |
set +e # Don't exit on error; we capture the exit code manually below
# -q suppresses uv's download/install noise on stderr
# sed strips hardcoded ANSI escape codes (claudelint doesn't support NO_COLOR)
uvx -q "claudelint==${CLAUDELINT_VERSION}" --strict \
| sed 's/\x1b\[[0-9;]*m//g' \
| tee claudelint.txt
EXIT_CODE=${PIPESTATUS[0]}
echo "exit_code=${EXIT_CODE}" >> $GITHUB_OUTPUT
# Capture output for PR comment
{
echo "report<<EOF"
cat claudelint.txt
echo "EOF"
} >> $GITHUB_OUTPUT
exit 0 # Always succeed so the PR comment step runs before we fail the job
- name: Prepare claudelint results
if: always()
id: prepare-comment
run: |
EXIT_CODE="${{ steps.claudelint.outputs.exit_code }}"
if [ "$EXIT_CODE" = "0" ]; then
echo "header=✅ claudelint — All checks passed" >> $GITHUB_OUTPUT
echo "details_open=" >> $GITHUB_OUTPUT # Empty = <details> closed by default
else
echo "header=❌ claudelint — Issues found" >> $GITHUB_OUTPUT
echo "details_open= open" >> $GITHUB_OUTPUT # Leading space + "open" renders as <details open>
fi
- name: Post claudelint results as PR comment
if: ${{ always() && github.event_name == 'pull_request' }}
uses: thollander/actions-comment-pull-request@24bffb9b452ba05a4f3f77933840a6a841d1b32b # v3.0.1
with:
comment-tag: claudelint
mode: recreate
message: |
## ${{ steps.prepare-comment.outputs.header }}
<details${{ steps.prepare-comment.outputs.details_open }}>
<summary>Full report</summary>
```
${{ steps.claudelint.outputs.report }}
```
</details>
> [`claudelint ${{ env.CLAUDELINT_VERSION }}`](https://github.com/stbenjam/claudelint) · [config](${{ github.server_url }}/${{ github.repository }}/blob/${{ github.event.pull_request.head.sha }}/.claudelint.yaml) · [custom rules](${{ github.server_url }}/${{ github.repository }}/blob/${{ github.event.pull_request.head.sha }}/.claudelint/rules.py) · [run](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})
- name: Fail if claudelint failed
if: steps.claudelint.outputs.exit_code != '0'
run: exit 1
- name: Upload linter output
if: always()
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.4.0
with:
name: claudelint-report
path: claudelint.txt
if-no-files-found: error