Skip to content

Commit

Permalink
Merge pull request #116 from nobbi1991/pipelines
Browse files Browse the repository at this point in the history
Pipelines
  • Loading branch information
nobbi1991 authored Dec 14, 2024
2 parents 7a25b91 + e974bea commit 86a83e4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 54 deletions.
64 changes: 12 additions & 52 deletions .github/workflows/update_pre_commit_hooks.yml
Original file line number Diff line number Diff line change
@@ -1,64 +1,24 @@
name: Update pre-commit hooks
name: Pre-commit auto-update

on:
# every day at midnight
schedule:
- cron: "0 0 * * *"
workflow_dispatch:

jobs:
update-pre-commit-hooks:
auto-update:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install pre-commit
run: |
python -m pip install --upgrade pip
pip install pre-commit
- name: Run pre-commit autoupdate
run: pre-commit autoupdate

- name: Set git user identity
run: |
git config --global user.email "[email protected]"
git config --global user.name "GitHub Actions"
- name: Check for changes and push updates
id: check-for-changes
run: |
if git diff --quiet && git diff --cached --quiet; then
echo "No changes detected, skipping commit."
echo "::set-output name=changes_found::false"
exit 0
fi
BRANCH_NAME="pre-commit-updates"
git fetch origin
if git rev-parse --verify origin/$BRANCH_NAME; then
echo "Branch $BRANCH_NAME exists, switching to it."
git stash
git checkout $BRANCH_NAME
else
echo "Branch $BRANCH_NAME does not exist, creating it."
git checkout -b $BRANCH_NAME
fi
git add .pre-commit-config.yaml
git commit -m 'Update pre-commit hook versions'
git push -u origin $BRANCH_NAME
echo "::set-output name=changes_found::true"
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- uses: browniebroke/pre-commit-autoupdate-action@main
- uses: peter-evans/create-pull-request@v7

- name: Create pull request
if: steps.check-for-changes.outputs.changes_found == 'true'
uses: peter-evans/create-pull-request@v7
if: always()
with:
title: 'Update pre-commit hook versions'
body: 'Automated update of pre-commit hooks'
branch: ${{ github.ref_name }}
delete-branch: true
commit-message: 'Update pre-commit hook versions'
branch: update/pre-commit-hooks
title: Update pre-commit hooks
labels: 'pre-commit, automated'
commit-message: "chore: update pre-commit hooks"
body: Update versions of pre-commit hooks to latest version.
2 changes: 0 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ repos:
rev: 0.7.19
hooks:
- id: mdformat

- repo: local
hooks:
- id: version-check
Expand All @@ -52,4 +51,3 @@ repos:
pass_filenames: false
additional_dependencies:
- requests
- pytz

0 comments on commit 86a83e4

Please sign in to comment.