Skip to content

Commit

Permalink
Add automerge bot for dependabot and pre-commit.ci PRs (#2)
Browse files Browse the repository at this point in the history
* add automerge bot

* better workflow
  • Loading branch information
Mathieu Scheltienne authored Dec 10, 2024
1 parent 2d70384 commit dd6c224
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 17 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/bot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: bot
concurrency:
group: ${{ github.workflow }}-${{ github.event.number }}-${{ github.event.ref }}
cancel-in-progress: true
on: # yamllint disable-line rule:truthy
pull_request

permissions:
contents: write
pull-requests: write

jobs:
auto-merge:
runs-on: ubuntu-latest
if: (github.event.pull_request.user.login == 'dependabot[bot]' || github.event.pull_request.user.login == 'pre-commit-ci[bot]') && github.repository == 'fcbg-platforms/it-documentary-system-validator'
steps:
- name: Enable auto-merge for bot PRs
run: gh pr merge --auto --squash "$PR_URL"
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
24 changes: 7 additions & 17 deletions .github/workflows/pytest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,26 +20,16 @@ jobs:
python-version: ["3.11"]
name: ${{ matrix.os }} - py${{ matrix.python-version }}
runs-on: ${{ matrix.os }}-latest
defaults:
run:
shell: bash
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install package
run: |
python -m pip install --progress-bar off --upgrade pip setuptools
python -m pip install --progress-bar off .[test]
- name: Display system information
run: fcbg-ruff sys-info --developer
- name: Run pytest
run: pytest fcbg_ruff --cov=fcbg_ruff --cov-report=xml --cov-config=pyproject.toml
- name: Upload to codecov
uses: codecov/codecov-action@v5
- uses: astral-sh/setup-uv@v4
- run: uv pip install --quiet --system .[test]
- run: fcbg-ruff sys-info --developer
- run: pytest fcbg_ruff --cov=fcbg_ruff --cov-report=xml --cov-config=pyproject.toml
- uses: codecov/codecov-action@v5
with:
files: ./coverage.xml
flags: unittests # optional
Expand Down

0 comments on commit dd6c224

Please sign in to comment.