Skip to content

ci: Dismiss PR approval on edit #253

ci: Dismiss PR approval on edit

ci: Dismiss PR approval on edit #253

Workflow file for this run

name: Test
on:
push:
branches: [main]
pull_request:
branches: [main]
types: [opened, edited, reopened, synchronize]
merge_group:
branches: [main]
env:
POETRY_VERSION: 1.6.1
CONVCO_VERSION: v0.4.2
jobs:
test-python:
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
# Test against all supported Python minor versions
# Specified only minor version: the latest patch is used
python-version: ['3.11', '3.10', '3.9', '3.8']
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install poetry
run: curl -sSL https://install.python-poetry.org | python3 - --version ${{ env.POETRY_VERSION }}
- id: cache
uses: actions/cache@v3
with:
path: .venv/
key: ${{ runner.os }}-python-${{ matrix.python-version }}-poetry-${{ hashFiles('pyproject.toml') }}
- name: Install dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: |
poetry config --local virtualenvs.in-project true
poetry env use ${{ matrix.python-version }}
poetry install -E all
- name: Test python
run: |
poetry run python -m pytest --disable-warnings --cov=edvart tests/
- name: Lint
run: |
poetry run pylint --rcfile=.pylintrc edvart/
poetry run black --check --line-length 100 edvart/ tests/
poetry run isort --check --line-length 100 --profile black edvart/ tests/
dismiss-stale-reviews:
runs-on: ubuntu-22.04
if: github.event_name == 'pull_request' && github.event.action == 'edited'
steps:
- name: Auth. Github-CLI
run: echo ${{ secrets.GITHUB_TOKEN }} | gh auth login --with-token
- name: Dismiss approvals
run: |
gh api repos/${{ github.repository }}/pulls/${{ github.event.number }}/reviews \
--jq '.[] | select(.state = "APPROVED") | .id' \
| xargs -I '{}' gh api --method=PUT -f message="Dismissed due to PR edit." \
repos/${{ github.repository }}/pulls/${{ github.event.number }}/reviews/'{}'/dismissals
commit-check:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # actions/checkout checks out HEAD only by default
- name: Get convco
run: |
curl -sSfL https://github.com/convco/convco/releases/download/${{ env.CONVCO_VERSION }}/convco-ubuntu.zip | zcat > /usr/local/bin/convco
chmod +x /usr/local/bin/convco
- name: Check pull request title
if: github.event_name == 'pull_request'
run: echo "${{ github.event.pull_request.title }}" | convco check --from-stdin
- name: Check all commits
if: github.ref == 'refs/heads/main'
run: convco check