-
Notifications
You must be signed in to change notification settings - Fork 64
43 lines (36 loc) · 1.17 KB
/
pre-commit-apply-command.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
name: pre-commit-apply
on:
repository_dispatch:
types: [pre-commit-apply-command]
jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
token: ${{ secrets.NEPTUNE_BOT_ACCESS_TOKEN }}
ref: ${{ github.event.client_payload.pull_request.head.ref }}
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install pre-commit
run: pip install pre-commit
- name: Pre-commit
id: pre-commit
continue-on-error: true
run: pre-commit run --all-files
- name: Commit to the PR branch
if: steps.pre-commit.outcome != 'success'
run: |
git config --global user.name '${{ secrets.NEPTUNE_BOT_USERNAME }}'
git config --global user.email '${{ secrets.NEPTUNE_BOT_EMAIL }}'
git commit -am "pre-commit applied"
git push
- name: Add reaction
uses: peter-evans/create-or-update-comment@v4
with:
token: ${{ secrets.NEPTUNE_BOT_ACCESS_TOKEN }}
comment-id: ${{ github.event.client_payload.github.payload.comment.id }}
reaction-type: hooray