-
Notifications
You must be signed in to change notification settings - Fork 23
40 lines (40 loc) · 1.45 KB
/
update-pre-commit-hooks.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
name: Update pre-commit hooks
on:
workflow_dispatch:
schedule:
# Run at 8:00 AM every day
- cron: "0 8 * * *"
jobs:
update-pre-commit-hooks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b
with:
python-version: "3.12"
- name: Install prerequisites
run: |
pip install pre-commit tox
- name: Update pre-commit hooks
run: |
pre-commit autoupdate
- name: Check for pre-commit config file changes
id: git_diff
run: |
echo "GIT_DIFF=$(git diff --exit-code 1> /dev/null; echo $?)" >> $GITHUB_OUTPUT
- name: Run tests
if: steps.git_diff.outputs.GIT_DIFF == 1
# We want to make sure that the new updates do not affect the code
run: |
make tests
- name: Create Pull Request
uses: peter-evans/create-pull-request@5e914681df9dc83aa4e4905692ca88beb2f9e91f
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "build: Update pre-commit hooks"
branch: "rstuf-bot/update-pre-commit-hooks"
delete-branch: true
title: "build: Update pre-commit hooks"
body: >
The following PR updates the pre-commit hooks (`.pre-commit-config.yaml` file) using `pre-commit autoupdate`.
labels: report, automated pr, pre-commit