From ea21973d562e600999758542eff8fb05fdac9e2c Mon Sep 17 00:00:00 2001 From: gtrevisan Date: Fri, 17 May 2024 15:18:41 -0400 Subject: [PATCH 1/3] prerun pylint in PRs --- .github/workflows/lint.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 593c6a63..196b4065 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -44,12 +44,24 @@ jobs: steps: - uses: actions/checkout@v4 + with: + fetch-depth: 0 - name: Install requirements run: | pip install -r .pip/main.txt -r .pip/dev.txt -r .pip/lab.txt pip install -e . + - name: Pre-run pylint + if: github.event.pull_request.draft == false + run: | + git reset --hard "${{ github.event.pull_request.base.sha }}" + git log -1 + pylint disruption_py examples tests \ + --msg-template='{path}:{line}:{column}: |{msg_id} {symbol}| {msg}' + git reset --hard "${{ github.event.pull_request.head.sha }}" + git log -1 + - name: Run pylint run: | pylint --version From 1d390d6911284131249ce5a09f3c8150b1854859 Mon Sep 17 00:00:00 2001 From: gtrevisan Date: Fri, 17 May 2024 15:19:56 -0400 Subject: [PATCH 2/3] output code rating as summary --- .github/workflows/lint.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 196b4065..bbc0d6f3 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -86,7 +86,8 @@ jobs: - name: Print final summary run: | tail pylint.log \ - | grep '^Your code has been rated' + | grep '^Your code has been rated' \ + | tee -a "$GITHUB_STEP_SUMMARY" shellcheck: From f7f871c7409ab3ed097e8a1ff3cead6f7c2271da Mon Sep 17 00:00:00 2001 From: gtrevisan Date: Fri, 17 May 2024 15:25:38 -0400 Subject: [PATCH 3/3] drop output and RC from pre-run --- .github/workflows/lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index bbc0d6f3..fb32cc67 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -58,7 +58,7 @@ jobs: git reset --hard "${{ github.event.pull_request.base.sha }}" git log -1 pylint disruption_py examples tests \ - --msg-template='{path}:{line}:{column}: |{msg_id} {symbol}| {msg}' + | grep '^Your code has been rated' git reset --hard "${{ github.event.pull_request.head.sha }}" git log -1