Skip to content

Commit 14667c1

Browse files
Merge pull request #5163 from crueter/fix-pr-format
CI: fix pr-code-format
2 parents b324cfb + 96b8904 commit 14667c1

File tree

1 file changed

+17
-23
lines changed

1 file changed

+17
-23
lines changed
Lines changed: 17 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
# Inspired by LLVM's pr-code-format.yml at
1+
# Inspired by LLVM's pr-code-format.yml at
22
# https://github.com/llvm/llvm-project/blob/main/.github/workflows/pr-code-format.yml
33

4-
name: "Check code formatting"
4+
name: Check code formatting
55
on:
66
pull_request:
77
branches:
@@ -13,7 +13,7 @@ jobs:
1313
if: github.repository == 'FEX-Emu/FEX'
1414

1515
steps:
16-
- name: Fetch FEX sources
16+
- name: Checkout
1717
uses: actions/checkout@v4
1818
with:
1919
ref: ${{ github.event.pull_request.head.sha }}
@@ -27,43 +27,37 @@ jobs:
2727
deepen_length: 500
2828

2929
- name: Get changed files
30-
id: changed-files
31-
uses: step-security/changed-files@3dbe17c78367e7d60f00d78ae6781a35be47b4a1 # v45.0.1
32-
with:
33-
separator: ","
34-
skip_initial_fetch: true
35-
36-
- name: "Listed files"
37-
env:
38-
CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
3930
run: |
40-
echo "Formatting files:"
41-
echo "$CHANGED_FILES"
31+
BASE=$(git merge-base main HEAD)
32+
FILES=$(git diff --name-only "$BASE" | tr '\n' ',' | sed 's/,$//')
33+
echo "CHANGED_FILES=$FILES" >> $GITHUB_ENV
34+
35+
echo "Changed files:"
36+
echo "$FILES"
4237
4338
- name: Check git-clang-format-19 exists
4439
run: which git-clang-format-19
4540

4641
- name: Setup Python env
4742
uses: actions/setup-python@v4
4843
with:
49-
python-version: '3.11'
50-
cache: 'pip'
51-
cache-dependency-path: './External/code-format-helper/requirements_formatting.txt'
44+
python-version: 3.11
45+
cache: pip
46+
cache-dependency-path: ./External/code-format-helper/requirements_formatting.txt
5247

5348
- name: Install python dependencies
5449
run: pip install -r ./External/code-format-helper/requirements_formatting.txt
5550

5651
- name: Run code formatter
5752
env:
58-
CLANG_FORMAT_PATH: 'git-clang-format-19'
53+
CLANG_FORMAT_PATH: git-clang-format-19
5954
GITHUB_PR_NUMBER: ${{ github.event.pull_request.number }}
6055
START_REV: ${{ github.event.pull_request.base.sha }}
6156
END_REV: ${{ github.event.pull_request.head.sha }}
62-
CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
6357
run: |
6458
python ./External/code-format-helper/code-format-helper.py \
65-
--repo "FEX-emu/FEX" \
66-
--issue-number $GITHUB_PR_NUMBER \
67-
--start-rev $START_REV \
68-
--end-rev $END_REV \
59+
--repo "FEX-Emu/FEX" \
60+
--issue-number "$GITHUB_PR_NUMBER" \
61+
--start-rev "$START_REV" \
62+
--end-rev "$END_REV" \
6963
--changed-files "$CHANGED_FILES"

0 commit comments

Comments
 (0)