From 198284657a2ba3aef813777ecb3d1cb74316ddd5 Mon Sep 17 00:00:00 2001 From: Marco Gorelli Date: Sun, 13 Dec 2020 11:19:12 +0000 Subject: [PATCH] add slash workflow --- .github/workflows/dispatched_pre-commit.yml | 33 +++++++++++++++++++++ .github/workflows/slash_dispatch.yml | 15 ++++++++++ 2 files changed, 48 insertions(+) create mode 100644 .github/workflows/dispatched_pre-commit.yml create mode 100644 .github/workflows/slash_dispatch.yml diff --git a/.github/workflows/dispatched_pre-commit.yml b/.github/workflows/dispatched_pre-commit.yml new file mode 100644 index 0000000000..fcf4e4b36d --- /dev/null +++ b/.github/workflows/dispatched_pre-commit.yml @@ -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 diff --git a/.github/workflows/slash_dispatch.yml b/.github/workflows/slash_dispatch.yml new file mode 100644 index 0000000000..b859778d83 --- /dev/null +++ b/.github/workflows/slash_dispatch.yml @@ -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