Skip to content

Commit

Permalink
add slash workflow (#4330)
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcoGorelli authored Dec 14, 2020
1 parent f778046 commit f4552e3
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/dispatched_pre-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: run pre-commit

on:
repository_dispatch:
types: [pre-commit-run-command]
jobs:
runPreCommit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
repository: ${{github.event.client_payload.pull_request.head.repo.full_name}}
ref: ${{github.event.client_payload.pull_request.head.ref}}
token: ${{ secrets.ACTION_TRIGGER_TOKEN }}
- name: Cache multiple paths
uses: actions/cache@v2
with:
path: |
~/.cache/pre-commit
~/.cache/pip
key: pre-commit-dispatched-${{ runner.os }}-build
- uses: actions/setup-python@v2
with:
python-version: 3.8
- name: install-pre-commit
run: python -m pip install --upgrade pre-commit
- name: Slash Command Dispatch
run: pre-commit run --all-files || (exit 0)
- run: |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git commit -m "Run pre-commit" -a
git push
15 changes: 15 additions & 0 deletions .github/workflows/slash_dispatch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Slash Command Dispatch
on:
issue_comment:
types: [created]
jobs:
slashCommandDispatch:
runs-on: ubuntu-latest
steps:
- name: Slash Command Dispatch
uses: peter-evans/slash-command-dispatch@v2
with:
token: ${{ secrets.ACTION_TRIGGER_TOKEN }}
issue-type: pull-request
commands: |
pre-commit-run

0 comments on commit f4552e3

Please sign in to comment.