@@ -3,7 +3,10 @@ concurrency:
33 group : ${{ github.workflow }}-${{ github.event.number }}-${{ github.event.ref }}
44 cancel-in-progress : true
55on : # yamllint disable-line rule:truthy
6- pull_request
6+ pull_request :
7+ schedule :
8+ - cron : ' 0 3 * * *'
9+ workflow_dispatch :
710
811permissions :
912 contents : write
@@ -12,25 +15,27 @@ permissions:
1215jobs :
1316 uv-lock :
1417 runs-on : ubuntu-latest
15- if : github.repository == 'mscheltienne/template-python' # prevent running on forks
18+ if : ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}
1619 steps :
1720 - uses : actions/checkout@v4
18- with :
19- token : ${{ secrets.GITHUB_TOKEN }}
2021 - uses : astral-sh/setup-uv@v6
2122 - run : uv lock --upgrade
22- - name : Commit changes
23+ - uses : autofix-ci/action@v1.3.2
24+ if : ${{ github.event_name == 'pull_request' }}
25+ - name : Push lock file changes
26+ if : ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}
2327 run : |
24- git config --local user.name 'github-actions[bot]'
25- git config --local user.email 'github-actions[bot]@users.noreply.github.com'
26- git add uv.lock
27- git diff --staged --quiet || git commit -m "Update uv.lock"
28- git push
28+ git config user.name 'github-actions[bot]'
29+ git config user.email 'github-actions[bot]@users.noreply.github.com'
30+ if [ -n "$(git status --porcelain)" ]; then
31+ git add uv.lock
32+ git commit -m "Upgrade uv.lock"
33+ git push origin main
34+ fi
2935
3036 auto-merge :
31- needs : uv-lock
3237 runs-on : ubuntu-latest
33- if : (github.event.pull_request.user.login == 'dependabot[bot]' || github.event.pull_request.user.login == 'pre-commit-ci[bot]') && github.repository == 'mscheltienne/template-python'
38+ 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' }}
3439 steps :
3540 - name : Enable auto-merge for bot PRs
3641 run : gh pr merge --auto --squash "$PR_URL"
0 commit comments