Skip to content

Commit 5fc06b9

Browse files
authored
Merge 468ad4f into d5f7925
2 parents d5f7925 + 468ad4f commit 5fc06b9

File tree

2 files changed

+55
-1
lines changed

2 files changed

+55
-1
lines changed

.github/workflows/format.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
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}}

PasteIntoFile/ClipboardContents.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff 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);

0 commit comments

Comments
 (0)