-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
CI: add slash dispatch workflow to trigger pre-commit checks with comment #38444
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
4b73eac
add slash command workflow
MarcoGorelli 955a0ed
use arrow's action
MarcoGorelli 80d5c57
update with more specific commit message
MarcoGorelli ee9ec53
Merge remote-tracking branch 'upstream/master' into slash-command
MarcoGorelli 00fd052
remove license from file
MarcoGorelli 5a9a00e
Merge remote-tracking branch 'upstream/master' into slash-command
MarcoGorelli File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 }} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this use the author of the last commit on the PR as commiter here?
Maybe your original "github actions" user is more transparent in who commited it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, using the PR author / last commiter as commit author here is maybe good. That avoids that github wants to add the bot to the "Co-authored-by", which is not needed.
A "[automated commit]" in the commit message should be clear enough about the origin of the change.