Skip to content

Commit

Permalink
chore: create workflow to update pre-commit outedated hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
jairhenrique committed Dec 19, 2023
1 parent 4498b1f commit ee2c2ac
Showing 1 changed file with 53 additions and 0 deletions.
53 changes: 53 additions & 0 deletions .github/workflows/pre-commit-detect-outdated.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Detect outdated pre-commit hooks

on:
schedule:
- cron: '0 0 * * 1' # Every Monday at midnight

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@v4

- name: Set up Python 3.12
uses: actions/setup-python@v4
with:
python-version: 3.12

- name: Install pre-commit
run: |
pip install 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@v5
with:
author: 'pre-commit <pre-commit@tools.invalid>'
base: main
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 }}"

0 comments on commit ee2c2ac

Please sign in to comment.