Skip to content

Commit f8a46ee

Browse files
authored
Merge e5c5521 into d5f7925
2 parents d5f7925 + e5c5521 commit f8a46ee

File tree

2 files changed

+55
-2
lines changed

2 files changed

+55
-2
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 =~ [Bb]ot ]]; 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 & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -836,8 +836,9 @@ public static ClipboardContents FromClipboard() {
836836
}
837837

838838
// Image from encoded data uri
839-
if (Clipboard.ContainsText()) {
840-
var (mime_ext, bytes) = BytesFromDataUri(Clipboard.GetText());
839+
if (Clipboard.ContainsText())
840+
{
841+
var (mime_ext, bytes) = BytesFromDataUri(Clipboard.GetText());
841842
if (bytes != null && !images.ContainsKey(mime_ext))
842843
if (ImageContentFromBytes(mime_ext, bytes) is ImageLikeContent imageContent)
843844
images.Add(mime_ext, imageContent);

0 commit comments

Comments
 (0)