Skip to content

Commit

Permalink
ci: add pre-commit update
Browse files Browse the repository at this point in the history
  • Loading branch information
tekumara committed Mar 10, 2024
1 parent c512692 commit 995ad33
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 7 deletions.
6 changes: 0 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,5 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Cache virtualenv
id: cache-venv
uses: actions/cache@v4
with:
path: .venv
key: ${{ runner.os }}-py${{ steps.setup-python.outputs.python-version }}-venv
- name: make test
run: make test
40 changes: 40 additions & 0 deletions .github/workflows/pre-commit-update.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Until Dependabot support is released https://github.com/dependabot/dependabot-core/issues/1524
name: Pre-commit update

on:
# first day of every month
schedule:
- cron: "0 0 1 * *"
workflow_dispatch:

permissions:
contents: write

jobs:
update:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
id: setup-python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"
- name: make test
run: make test
- name: pre-commit autoupdate
run: make pc-update
- name: Commit and push
run: |
git add .
git commit -m bump
git push -f origin HEAD:bump-pre-commit-hooks
- name: Open pull request
env:
GH_TOKEN: ${{ github.token }}
run: |
gh pr create --title "chore: bump pre-commit hooks"
7 changes: 6 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ clean:
rm -rf $(test-cookie)

## bake a test cookie and run make hooks
test: $(cookiecutter) clean
test: clean $(test-cookie)

$(test-cookie): $(cookiecutter)
$(cookiecutter) -o $(test-cookie)/../ --no-input --config-file cookiecutter-config.yaml .
ifndef SKIP_HOOKS
cd $(test-cookie) && git init && git add . && make hooks
Expand All @@ -31,3 +33,6 @@ outdated: $(test-cookie)
$(test-cookie)/.venv/bin/pip list --outdated
cd $(test-cookie) && npm outdated

pc-update: $(test-cookie)
cd $(test-cookie) && .venv/bin/pre-commit autoupdate
cp $(test-cookie)/.pre-commit-config.yaml {{cookiecutter.repo_name}}/

0 comments on commit 995ad33

Please sign in to comment.