-
-
Notifications
You must be signed in to change notification settings - Fork 1
58 lines (54 loc) · 1.73 KB
/
a_pre_commit.yml
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
51
52
53
54
55
56
57
58
name: Pre-commit
on:
pull_request_target:
push:
branches: [main]
permissions:
contents: write
pull-requests: write
jobs:
update:
# if: ${{ github.event.pull_request.user.login != 'dependabot[bot]' }}
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
token: ${{ secrets.TOKEN }}
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.12
- name: Set up git config
run: |
git config --global user.email "GitHub Action <action@github.com>"
git config --global user.name "GitHub Action <action@github.com>"
- name: Install Dependencies
run: |
pip install pre-commit==3.6.0
- name: Run pre-commit and git add
run: |
pre-commit run -c .pre-commit-config.yaml || true
git add .
git diff --staged --quiet || git commit -m ":file_folder: pre-commit
> Made via .github/workflows/a_pre_commit.yml" || echo "pre-commit: no changes"
- name: Create Pull Request
uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.TOKEN }}
commit-message: Update files
committer: GitHub Action <action@github.com>
author: GitHub Action <action@github.com>
signoff: true
branch: pre-commit
# base: main
title: "🔨 Update files by <github-actions[bot]>"
body: |
Auto-generated by [create-pull-request][1]
[1]: https://github.com/peter-evans/create-pull-request
labels: |
wait
in progress
bot
draft: false
delete-branch: true