Add --validate-rules, --dry-run, --comment-on-failure to land command #256
This file contains hidden or 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: Lint | |
| on: | |
| pull_request: | |
| push: | |
| branches: | |
| - master | |
| jobs: | |
| lint: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.13"] | |
| os: ["ubuntu-latest"] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v3 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| enable-cache: true | |
| cache-suffix: "optional-suffix" | |
| - name: Run lint | |
| run: | | |
| RC=0 | |
| # Run lintrunner on all files | |
| if ! uv run --frozen lintrunner --force-color --all-files --tee-json=lint.json 2> /dev/null; then | |
| echo "" | |
| echo -e "\e[1m\e[36mYou can reproduce these results locally by using \`lintrunner\`. (If you don't get the same results, run \'lintrunner init\' to update your local linter)\e[0m" | |
| RC=1 | |
| fi | |
| # Use jq to massage the JSON lint output into GitHub Actions workflow commands. | |
| jq --raw-output \ | |
| '"::\(if .severity == "advice" or .severity == "disabled" then "warning" else .severity end) file=\(.path),line=\(.line),col=\(.char),title=\(.code) \(.name)::" + (.description | gsub("\\n"; "%0A"))' \ | |
| lint.json || true | |
| exit $RC |