File tree Expand file tree Collapse file tree 2 files changed +55
-1
lines changed Expand file tree Collapse file tree 2 files changed +55
-1
lines changed Original file line number Diff line number Diff line change 1+ name : Auto-fix file format
2+
3+ # Since pre-commit.ci cannot run local hooks, run them here manually to fixup formatting in pull requests
4+
5+ on : pull_request
6+
7+ env :
8+ # SSH Deploy Key with write access (needed to trigger push workflow runs in created pull request)
9+ SSH_KEY : ${{ secrets.SSH_KEY_GITHUB_ACTION }}
10+
11+ jobs :
12+ pre-commit :
13+ name : Format files with pre-commit
14+ runs-on : ubuntu-24.04
15+ steps :
16+ - uses : actions/checkout@v5
17+ with :
18+ ssh-key : ${{ env.SSH_KEY }}
19+ fetch-depth : 0
20+
21+
22+ - name : Skip if bot
23+ run : |
24+ AUTHOR=$(git log -1 --pretty=%an)
25+ if [[ $AUTHOR =~ "bot|Bot" ]]; then
26+ echo "Commit made by bot, skipping further steps in the pipeline."
27+ exit 0
28+ fi
29+
30+ - name : Install python
31+ uses : actions/setup-python@v3
32+
33+ - name : Install pre-commit
34+ run : |
35+ python3 -m pip install pre-commit
36+ pre-commit install
37+
38+ - name : Format files
39+ continue-on-error : true
40+ id : check
41+ run : |
42+ FILES=$(git diff --name-only HEAD origin/$GITHUB_BASE_REF | tr '\n' ' ')
43+ echo $FILES
44+ pre-commit run --files $FILES
45+
46+ - name : Push formatted fixes
47+ if : steps.check.outcome == 'failure'
48+ run : |
49+ git config user.name "Bot"
50+ git config user.email "<[email protected] >" 51+ git commit -am "Fix file format"
52+ git push origin HEAD:${{github.event.pull_request.head.ref}}
Original file line number Diff line number Diff line change @@ -814,7 +814,9 @@ public static ClipboardContents FromClipboard() {
814814 var images = new Dict < string , ImageLikeContent > ( ) ;
815815
816816 // Generic image from file
817- if ( Clipboard . ContainsFileDropList ( ) && Clipboard . GetFileDropList ( ) is StringCollection files && files . Count == 1 ) {
817+ if ( Clipboard . ContainsFileDropList ( ) && Clipboard . GetFileDropList ( ) is StringCollection files && files . Count == 1 )
818+
819+ {
818820 var ext = BaseContent . NormalizeExtension ( Path . GetExtension ( files [ 0 ] ) . Trim ( '.' ) ) ;
819821 if ( ImageContentFromBytes ( ext , File . ReadAllBytes ( files [ 0 ] ) ) is ImageLikeContent imageContent )
820822 images . Add ( ext , imageContent ) ;
You can’t perform that action at this time.
0 commit comments