From 7480645094dd852e25e1242406cc0fd1c7e9ee87 Mon Sep 17 00:00:00 2001 From: Justin Chu Date: Tue, 17 Sep 2024 11:56:21 -0700 Subject: [PATCH 1/3] Create suggestions to autofix files --- .github/workflows/lint.yml | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 2edbe2d814533..25b647b392ca4 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -72,6 +72,33 @@ jobs: category: lintrunner checkout_path: ${{ github.workspace }} + auto-apply-lint: + name: Suggest lintrunner changes + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Setup Python + uses: actions/setup-python@v5 + with: + # Version range or exact version of Python to use, using SemVer's version range syntax. Reads from .python-version if unset. + python-version: "3.10" + - name: Setup Rust + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + components: rustfmt + - name: Install dependencies + run: | + python -m pip install -r requirements-dev.txt + python -m pip install lintrunner lintrunner-adapters + lintrunner init + - name: Run lintrunner on all files + run: | + lintrunner f --all-files -v + - uses: parkerbxyz/suggest-changes@v1 + with: + comment: 'You can commit the suggested changes from lintrunner.' + lint-cpp: name: Optional Lint C++ runs-on: ubuntu-latest From 5dd45a2a004c3544b5d4f482135799bc6bc07e41 Mon Sep 17 00:00:00 2001 From: Justin Chu Date: Tue, 17 Sep 2024 17:20:42 -0700 Subject: [PATCH 2/3] Update lint.yml --- .github/workflows/lint.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 25b647b392ca4..27e2eadb52cc7 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -72,8 +72,8 @@ jobs: category: lintrunner checkout_path: ${{ github.workspace }} - auto-apply-lint: - name: Suggest lintrunner changes + auto-apply-fixes: + name: Suggest fixes runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -94,7 +94,9 @@ jobs: lintrunner init - name: Run lintrunner on all files run: | + set +e lintrunner f --all-files -v + exit 0 - uses: parkerbxyz/suggest-changes@v1 with: comment: 'You can commit the suggested changes from lintrunner.' From e93ed4c6a62dc3405ba2b56f9c1821b182f7dc73 Mon Sep 17 00:00:00 2001 From: Justin Chu Date: Thu, 10 Oct 2024 15:42:15 +0000 Subject: [PATCH 3/3] permissions --- .github/workflows/lint.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 27e2eadb52cc7..bc038f693194c 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -75,6 +75,9 @@ jobs: auto-apply-fixes: name: Suggest fixes runs-on: ubuntu-latest + permissions: + contents: read + pull-requests: write steps: - uses: actions/checkout@v4 - name: Setup Python