Skip to content

Commit f4552e3

Browse files
authored
add slash workflow (#4330)
1 parent f778046 commit f4552e3

File tree

2 files changed

+48
-0
lines changed

2 files changed

+48
-0
lines changed

Diff for: .github/workflows/dispatched_pre-commit.yml

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: run pre-commit
2+
3+
on:
4+
repository_dispatch:
5+
types: [pre-commit-run-command]
6+
jobs:
7+
runPreCommit:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v2
11+
with:
12+
repository: ${{github.event.client_payload.pull_request.head.repo.full_name}}
13+
ref: ${{github.event.client_payload.pull_request.head.ref}}
14+
token: ${{ secrets.ACTION_TRIGGER_TOKEN }}
15+
- name: Cache multiple paths
16+
uses: actions/cache@v2
17+
with:
18+
path: |
19+
~/.cache/pre-commit
20+
~/.cache/pip
21+
key: pre-commit-dispatched-${{ runner.os }}-build
22+
- uses: actions/setup-python@v2
23+
with:
24+
python-version: 3.8
25+
- name: install-pre-commit
26+
run: python -m pip install --upgrade pre-commit
27+
- name: Slash Command Dispatch
28+
run: pre-commit run --all-files || (exit 0)
29+
- run: |
30+
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
31+
git config --local user.name "github-actions[bot]"
32+
git commit -m "Run pre-commit" -a
33+
git push

Diff for: .github/workflows/slash_dispatch.yml

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: Slash Command Dispatch
2+
on:
3+
issue_comment:
4+
types: [created]
5+
jobs:
6+
slashCommandDispatch:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- name: Slash Command Dispatch
10+
uses: peter-evans/slash-command-dispatch@v2
11+
with:
12+
token: ${{ secrets.ACTION_TRIGGER_TOKEN }}
13+
issue-type: pull-request
14+
commands: |
15+
pre-commit-run

0 commit comments

Comments
 (0)