Detect outdated pre-commit hooks #135
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copyright (c) 2021-2022 Sebastian Pipping <[email protected]> | |
# Licensed under GNU Affero GPL v3 or later | |
name: Detect outdated pre-commit hooks | |
on: | |
schedule: | |
- cron: '0 16 * * 5' # Every Friday 4pm | |
# NOTE: This will drop all permissions from GITHUB_TOKEN except metadata read, | |
# and then (re)add the ones listed below: | |
permissions: | |
contents: write | |
pull-requests: write | |
jobs: | |
pre_commit_detect_outdated: | |
name: Detect outdated pre-commit hooks | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0 | |
- name: Set up Python 3.11 | |
uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4.7.0 | |
with: | |
python-version: 3.11 | |
- name: Install pre-commit | |
run: |- | |
pip install \ | |
--disable-pip-version-check \ | |
--no-warn-script-location \ | |
--user \ | |
pre-commit | |
echo "PATH=${HOME}/.local/bin:${PATH}" >> "${GITHUB_ENV}" | |
- name: Check for outdated hooks | |
run: |- | |
pre-commit autoupdate | |
git diff -- .pre-commit-config.yaml | |
- name: Create pull request from changes (if any) | |
id: create-pull-request | |
uses: peter-evans/create-pull-request@153407881ec5c347639a548ade7d8ad1d6740e38 # v5.0.2 | |
with: | |
author: 'pre-commit <[email protected]>' | |
base: master | |
body: |- | |
For your consideration. | |
:warning: Please **CLOSE AND RE-OPEN** this pull request so that [further workflow runs get triggered](https://github.com/peter-evans/create-pull-request/blob/main/docs/concepts-guidelines.md#triggering-further-workflow-runs) for this pull request. | |
branch: precommit-autoupdate | |
commit-message: "pre-commit: Autoupdate" | |
delete-branch: true | |
draft: true | |
labels: enhancement | |
title: "pre-commit: Autoupdate" | |
- name: Log pull request URL | |
if: "${{ steps.create-pull-request.outputs.pull-request-url }}" | |
run: | | |
echo "Pull request URL is: ${{ steps.create-pull-request.outputs.pull-request-url }}" |