Skip to content

Writes comment rather than halting the pipeline. #3

Writes comment rather than halting the pipeline.

Writes comment rather than halting the pipeline. #3

Workflow file for this run

name: Continuous Integration
on:
push:
branches:
- '**'
pull_request:
branches:
- '**'
jobs:
unit-tests:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.7, 3.9, 3.12]
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r requirements-dev.txt
- name: Install GitHub CLI
run: |
sudo apt update
sudo apt install -y gh
- name: Authenticate GitHub CLI
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
echo "${GITHUB_TOKEN}" | gh auth login --with-token
- name: Lint with Black
id: black_check
continue-on-error: true
run: |
result=$(black --check . 2>&1)
echo "::set-output name=result::$result"
- name: Post results as comment
if: steps.black_check.outcome == 'failure'
run: |
gh pr comment "${{ github.event.pull_request.number }}" --body "Black formatting check failed:\n```\n${{ steps.black_check.outputs.result }}\n```"