Skip to content

Merge pull request #5 from sousa-miguel/dev-ci-pipeline #7

Merge pull request #5 from sousa-miguel/dev-ci-pipeline

Merge pull request #5 from sousa-miguel/dev-ci-pipeline #7

Workflow file for this run

name: CI Pipeline
on:
pull_request:
push:
branches:
- main
permissions:
contents: write
id-token: write
concurrency:
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
if: github.event_name == 'pull_request'
with:
ref: ${{ github.event.pull_request.head.ref }}
- name: Checkout
uses: actions/checkout@v4
if: github.event_name == 'push'
- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: '3.10'
- name: Install dependencies
run: pip install -r ./requirements.txt
- name: Lint
run: python3 -m black ./
- name: Commit any differences after linting
if: github.event_name == 'pull_request'
run: |
if [ "$(git status | grep -i 'modified\|untracked' | wc -l)" -gt "0" ]; then
echo "Detected some changes after linting, committing them now..."
git add .
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git commit -m "Linting changes"
git push
fi
- name: Test
run: python3 -m pytest ./