Skip to content

Commit

Permalink
CI: add slash dispatch workflow to trigger pre-commit checks with com…
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcoGorelli authored Dec 22, 2020
1 parent e067fe6 commit 4dff397
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/autoupdate-pre-commit-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- name: Update pre-commit config packages
uses: technote-space/create-pr-action@v2
with:
GITHUB_TOKEN: ${{ secrets.ACTION_TRIGGER_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
EXECUTE_COMMANDS: |
pip install pre-commit
pre-commit autoupdate || (exit 0);
Expand Down
40 changes: 40 additions & 0 deletions .github/workflows/comment_bot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Comment-bot

on:
issue_comment:
types:
- created
- edited

jobs:
autotune:
name: "Fixup pre-commit formatting"
if: startsWith(github.event.comment.body, '@github-actions pre-commit')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: r-lib/actions/pr-fetch@master
with:
repo-token: ${{ secrets.GITHUB_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: Run pre-commit
run: pre-commit run --all-files || (exit 0)
- name: Commit results
run: |
git config user.name "$(git log -1 --pretty=format:%an)"
git config user.email "$(git log -1 --pretty=format:%ae)"
git commit -a -m 'Fixes from pre-commit [automated commit]' || echo "No changes to commit"
- uses: r-lib/actions/pr-push@master
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 4dff397

Please sign in to comment.