-
Notifications
You must be signed in to change notification settings - Fork 109
50 lines (45 loc) · 1.43 KB
/
pre-commit-update.yml
File metadata and controls
50 lines (45 loc) · 1.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
name: pre-commit-update
on:
workflow_dispatch:
schedule:
- cron: "0 20 * * 1" # Run once weekly
permissions:
pull-requests: write
contents: write
defaults:
run:
shell: bash -l {0}
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
pre-commit-update:
name: Auto-update pre-commit hooks
runs-on: ubuntu-latest
steps:
- uses: actions/create-github-app-token@v1
id: generate-token
with:
app-id: ${{ secrets.TOKEN_GENERATOR_APP_ID }}
private-key: ${{ secrets.TOKEN_GENERATOR_APP_PRIVATE_KEY }}
- uses: actions/checkout@v4
- uses: conda-incubator/setup-miniconda@v3
with:
miniforge-variant: Miniforge3
miniforge-version: latest
conda-remove-defaults: "true"
activate-environment: precommit
environment-file: ops/conda_env/pre-commit.yml
use-mamba: true
- name: Update pre-commit hooks
run: |
pre-commit autoupdate
- name: Create Pull Request
uses: peter-evans/create-pull-request@v7
if: github.ref == 'refs/heads/mainline'
with:
branch: create-pull-request/pre-commit-update
base: mainline
title: "[CI] Update pre-commit hooks"
commit-message: "[CI] Update pre-commit hooks"
token: ${{ steps.generate-token.outputs.token }}