|
| 1 | +name: Update dependencies and pre-commit hooks |
| 2 | +on: |
| 3 | + schedule: |
| 4 | + - cron: "0 2 * * 1,3,5" # Every mon, wen, fri at 2am utc |
| 5 | + workflow_dispatch: |
| 6 | + inputs: |
| 7 | + automerge: |
| 8 | + description: "enable automerge" |
| 9 | + required: false |
| 10 | + type: boolean |
| 11 | + default: false |
| 12 | + |
| 13 | +permissions: |
| 14 | + contents: write |
| 15 | + pull-requests: write |
| 16 | + |
| 17 | +env: |
| 18 | + AUTOMERGE: "true" |
| 19 | + |
| 20 | +jobs: |
| 21 | + update: |
| 22 | + name: Bump versions |
| 23 | + runs-on: ubuntu-latest |
| 24 | + environment: pull-request |
| 25 | + steps: |
| 26 | + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 27 | + with: |
| 28 | + persist-credentials: false |
| 29 | + - uses: ./.github/actions/setup-cached-uv-and-python |
| 30 | + with: |
| 31 | + python-version-file: ".python-version" |
| 32 | + cache-dependency-path: requirements/lock/uvx-tools.txt |
| 33 | + - uses: extractions/setup-just@f8a3cce218d9f83db3a2ecd90e41ac3de6cdfd9b # v3.1.0 |
| 34 | + |
| 35 | + - name: Update requirements |
| 36 | + run: just lock --upgrade |
| 37 | + - name: Update pre-commit hooks |
| 38 | + run: just lint-upgrade |
| 39 | + |
| 40 | + - name: Git config |
| 41 | + run: | |
| 42 | + git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" |
| 43 | + git config --global user.name "github-actions[bot]" |
| 44 | +
|
| 45 | + - name: Create pull request |
| 46 | + id: cpr |
| 47 | + uses: peter-evans/create-pull-request@c0f553fe549906ede9cf27b5156039d195d2ece0 # v8.1.0 |
| 48 | + with: |
| 49 | + token: ${{ secrets.PAT }} |
| 50 | + add-paths: . |
| 51 | + commit-message: |
| 52 | + "chore(deps): update dependencies and pre-commit hooks" |
| 53 | + title: "chore(deps): update dependencies and pre-commit hooks" |
| 54 | + labels: dependencies |
| 55 | + branch: prek/autoupdate |
| 56 | + delete-branch: true |
| 57 | + body: | |
| 58 | + This is an autogenerated PR. Use this to merge changes to this repository. |
| 59 | +
|
| 60 | + - name: Pull request info |
| 61 | + if: ${{ steps.cpr.outputs.pull-request-number }} |
| 62 | + env: |
| 63 | + NUMBER: ${{ steps.cpr.outputs.pull-request-number }} |
| 64 | + URL: ${{ steps.cpr.outputs.pull-request-url }} |
| 65 | + OPERATION: ${{ steps.cpr.outputs.pull-request-operation }} |
| 66 | + SHA: ${{ steps.cpr.outputs.pull-request-sha }} |
| 67 | + BRANCH: ${{ steps.cpr.outputs.pull-request-branch }} |
| 68 | + VERIFIED: ${{ steps.cpr.outputs.pull-request-commits-verified }} |
| 69 | + run: | |
| 70 | + echo "Pull Request Number - $NUMBER" |
| 71 | + echo "Pull Request URL - $URL" |
| 72 | + echo "Pull Request Operation - $OPERATION" |
| 73 | + echo "Pull Request SHA - $SHA" |
| 74 | + echo "Pull Request BRANCH - $BRANCH" |
| 75 | + echo "Pull Request VERIFIED - $VERIFIED" |
| 76 | +
|
| 77 | + - name: automerge |
| 78 | + if: |
| 79 | + ${{ (inputs.automerge || env.AUTOMERGE == 'true') && |
| 80 | + steps.cpr.outputs.pull-request-number }} |
| 81 | + env: |
| 82 | + NUMBER: ${{ steps.cpr.outputs.pull-request-number }} |
| 83 | + # Need PAT if want to start other actions. Use GITHUB_TOKEN if not. |
| 84 | + GH_TOKEN: ${{ secrets.PAT }} |
| 85 | + run: | |
| 86 | + gh pr merge -m --auto "$NUMBER" |
0 commit comments