| 1 |
# Copyright 2023 The Archivista Contributors |
| 2 |
# |
| 3 |
# Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 |
# you may not use this file except in compliance with the License. |
| 5 |
# You may obtain a copy of the License at |
| 6 |
# |
| 7 |
# http://www.apache.org/licenses/LICENSE-2.0 |
| 8 |
# |
| 9 |
# Unless required by applicable law or agreed to in writing, software |
| 10 |
# distributed under the License is distributed on an "AS IS" BASIS, |
| 11 |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 |
# See the License for the specific language governing permissions and |
| 13 |
# limitations under the License. |
| 14 |
|
| 15 |
# This workflow uses actions that are not certified by GitHub. They are provided |
| 16 |
# by a third-party and are governed by separate terms of service, privacy |
| 17 |
# policy, and support documentation. |
| 18 |
|
| 19 |
name: Update pre-commit hooks |
| 20 |
on: |
| 21 |
workflow_dispatch: |
| 22 |
schedule: |
| 23 |
# Run at 8:00 AM every day |
| 24 |
- cron: "0 8 * * *" |
| 25 |
permissions: |
| 26 |
contents: read |
| 27 |
jobs: |
| 28 |
update-pre-commit-hooks: |
| 29 |
runs-on: ubuntu-latest |
| 30 |
permissions: |
| 31 |
contents: write |
| 32 |
pull-requests: write |
| 33 |
steps: |
| 34 |
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 |
| 35 |
- uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c |
| 36 |
with: |
| 37 |
python-version: "3.11" |
| 38 |
- name: Install prerequisites |
| 39 |
run: | |
| 40 |
pip install pre-commit==3.6.0 |
| 41 |
- name: Update pre-commit hooks |
| 42 |
run: | |
| 43 |
pre-commit autoupdate |
| 44 |
- name: Check for pre-commit config file changes |
| 45 |
id: git_diff |
| 46 |
run: | |
| 47 |
echo "GIT_DIFF=$(git diff --exit-code 1> /dev/null; echo $?)" >> $GITHUB_OUTPUT |
| 48 |
- name: Create Pull Request |
| 49 |
uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # v7.0.8 |
| 50 |
with: |
| 51 |
token: ${{ secrets.GITHUB_TOKEN }} |
| 52 |
commit-message: "build: Update pre-commit hooks" |
| 53 |
branch: "archivista-bot/update-pre-commit-hooks" |
| 54 |
delete-branch: true |
| 55 |
title: "build: Update pre-commit hooks" |
| 56 |
body: > |
| 57 |
The following PR updates the pre-commit hooks (`.pre-commit-config.yaml` file) using `pre-commit autoupdate`. |
| 58 |
labels: report, automated pr, pre-commit |