Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 22 additions & 16 deletions .github/workflows/bot.yaml
Original file line number Diff line number Diff line change
@@ -1,36 +1,42 @@
name: bot
name: autofix.ci
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
pull_request:
schedule:
- cron: '0 3 * * *'
workflow_dispatch:

jobs:
uv-lock:
permissions:
contents: write
runs-on: ubuntu-latest
if: github.repository == 'mscheltienne/template-python' # prevent running on forks
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
- uses: astral-sh/setup-uv@v6
- run: uv lock --upgrade
- name: Commit changes
- uses: autofix-ci/action@v1.3.2
if: ${{ github.event_name == 'pull_request' }}
- name: Push lock file changes
if: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}
run: |
git config --local user.name 'github-actions[bot]'
git config --local user.email 'github-actions[bot]@users.noreply.github.com'
git add uv.lock
git diff --staged --quiet || git commit -m "Update uv.lock"
git push
git config user.name 'github-actions[bot]'
git config user.email 'github-actions[bot]@users.noreply.github.com'
if [ -n "$(git status --porcelain)" ]; then
git add uv.lock
git commit -m "Upgrade uv.lock"
git push origin main
fi

auto-merge:
needs: uv-lock
permissions:
contents: write
pull-requests: write
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 == 'mscheltienne/template-python'
if: ${{ github.event_name == 'pull_request' && (github.event.pull_request.user.login == 'dependabot[bot]' || github.event.pull_request.user.login == 'pre-commit-ci[bot]') && github.repository == 'mscheltienne/template-python' }}
steps:
- name: Enable auto-merge for bot PRs
run: gh pr merge --auto --squash "$PR_URL"
Expand Down
Loading