Skip to content

Bsr bump spectree #18166

Bsr bump spectree

Bsr bump spectree #18166

Workflow file for this run

name: MyPy cop
on:
pull_request:
branches:
- master
jobs:
run-mypy-cop:
runs-on: [self-hosted, linux, x64]
steps:
- name: Checkout 🛎️
uses: actions/checkout@v3
with:
persist-credentials: false
- name: Check changes
uses: dorny/paths-filter@v2
id: changes
with:
filters: |
src:
- 'api/**'
- name: Count mypy ignore's on this branch and master
id: mypy-ignore-counter
if: steps.changes.outputs.src == 'true'
run: |
cd api
this_branch_ignore_count="$(grep "type: ignore" -r src | grep -v /alembic/versions/ | wc -l)"
git fetch origin master:master --quiet
git checkout master --quiet
master_ignore_count="$(grep "type: ignore" -r src | grep -v /alembic/versions/ | wc -l)"
git checkout - --quiet
echo "this_branch_ignore_count=$this_branch_ignore_count" >> $GITHUB_OUTPUT
echo "master_ignore_count=$master_ignore_count" >> $GITHUB_OUTPUT
- name: Create mypy cop report
id: mypy-cop
run: |
cd api
body="$(./mypy_cop.sh ${{ steps.mypy-ignore-counter.outputs.master_ignore_count }} ${{ steps.mypy-ignore-counter.outputs.this_branch_ignore_count }} )"
# See https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#multiline-strings
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
echo "body<<$EOF" >> $GITHUB_OUTPUT
echo "$body" >> $GITHUB_OUTPUT
echo "$EOF" >> $GITHUB_OUTPUT
- name: Find Comment
if: steps.changes.outputs.src == 'true'
uses: peter-evans/find-comment@v1
id: fc
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: "github-actions[bot]"
body-includes: "mypy cop report"
- name: Create comment
if: ${{ steps.changes.outputs.src == 'true' && steps.fc.outputs.comment-id == '' && steps.mypy-ignore-counter.outputs.this_branch_ignore_count != steps.mypy-ignore-counter.outputs.master_ignore_count }}
uses: peter-evans/create-or-update-comment@v1
with:
issue-number: ${{ github.event.pull_request.number }}
body: ${{ steps.mypy-cop.outputs.body }}
- name: Update comment
if: ${{ steps.changes.outputs.src == 'true' && steps.fc.outputs.comment-id != '' }}
uses: peter-evans/create-or-update-comment@v1
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
edit-mode: replace
body: ${{ steps.mypy-cop.outputs.body }}