forked from pandas-dev/pandas
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CI: add slash dispatch workflow to trigger pre-commit checks with com…
…ment (pandas-dev#38444)
- Loading branch information
1 parent
e067fe6
commit 4dff397
Showing
2 changed files
with
41 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |