From e77ef5e371e260349322b215c5fb87ec0f8b110c Mon Sep 17 00:00:00 2001 From: Remi Gau Date: Thu, 14 Dec 2023 01:19:42 +0100 Subject: [PATCH] add workflow to update precommit hooks --- .github/workflows/update_precommit_hooks.yml | 53 ++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 .github/workflows/update_precommit_hooks.yml diff --git a/.github/workflows/update_precommit_hooks.yml b/.github/workflows/update_precommit_hooks.yml new file mode 100644 index 0000000..a0cf4bf --- /dev/null +++ b/.github/workflows/update_precommit_hooks.yml @@ -0,0 +1,53 @@ +--- +name: Update precommit hooks + + +on: + +# Uses the cron schedule for github actions +# +# https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows#scheduled-events +# +# ┌───────────── minute (0 - 59) +# │ ┌───────────── hour (0 - 23) +# │ │ ┌───────────── day of the month (1 - 31) +# │ │ │ ┌───────────── month (1 - 12 or JAN-DEC) +# │ │ │ │ ┌───────────── day of the week (0 - 6 or SUN-SAT) +# │ │ │ │ │ +# │ │ │ │ │ +# │ │ │ │ │ +# * * * * * + schedule: + - cron: 0 0 * * 1 # every monday + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +jobs: + update_precommit_hooks: + + # only run on upstream repo + if: github.repository_owner == 'SIMEXP' + + runs-on: ubuntu-latest + steps: + - name: Checkout repo + uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.12' + allow-prereleases: false + - name: Install pre-commit + run: pip install pre-commit + - name: Update pre-commit hooks + run: pre-commit autoupdate + - name: Create Pull Request + uses: peter-evans/create-pull-request@v5 + with: + commit-message: pre-commit hooks auto-update + base: main + token: ${{ secrets.GITHUB_TOKEN }} + delete-branch: true + title: '[BOT] update pre-commit hooks' + body: done via this [GitHub Action](https://github.com/${{ github.repository_owner }}/giga_connectome/blob/main/.github/workflows/update_precommit_hooks.yml)