12
12
permissions :
13
13
pull-requests : write
14
14
steps :
15
- - name : Fetch LLVM sources
15
+ - name : Fetch DirectXShaderCompiler sources
16
16
uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
17
17
with :
18
18
ref : ${{ github.event.pull_request.head.sha }}
31
31
separator : " ,"
32
32
skip_initial_fetch : true
33
33
34
+ # We need to pull the script from the main branch, so that we ensure
35
+ # we get the latest version of this script.
36
+ - name : Fetch code formatting utils
37
+ uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
38
+ with :
39
+ repository : microsoft/DirectXShaderCompiler
40
+ ref : ${{ github.base_ref }}
41
+ sparse-checkout : |
42
+ utils/git/requirements_formatting.txt
43
+ utils/git/code-format-helper.py
44
+ utils/git/code-format-save-diff.py
45
+ sparse-checkout-cone-mode : false
46
+ path : code-format-tools
47
+
34
48
- name : " Listed files"
35
49
env :
36
50
LISTED_FILES : ${{ steps.changed-files.outputs.all_changed_files }}
@@ -48,10 +62,10 @@ jobs:
48
62
with :
49
63
python-version : ' 3.11'
50
64
cache : ' pip'
51
- cache-dependency-path : ' utils/git/requirements_formatting.txt'
65
+ cache-dependency-path : ' code-format-tools/ utils/git/requirements_formatting.txt'
52
66
53
67
- name : Install python dependencies
54
- run : pip install -r utils/git/requirements_formatting.txt
68
+ run : pip install -r code-format-tools/ utils/git/requirements_formatting.txt
55
69
56
70
- name : Run code formatter
57
71
id : formatter
61
75
END_REV : ${{ github.event.pull_request.head.sha }}
62
76
CHANGED_FILES : ${{ steps.changed-files.outputs.all_changed_files }}
63
77
run : |
64
- python utils/git/code-format-helper.py \
78
+ python code-format-tools/ utils/git/code-format-helper.py \
65
79
--token ${{ secrets.GITHUB_TOKEN }} \
66
80
--issue-number $GITHUB_PR_NUMBER \
67
81
--start-rev $START_REV \
@@ -92,28 +106,37 @@ jobs:
92
106
} catch (err) {
93
107
core.setFailed(`Request failed with error ${err}`)
94
108
}
95
- - name : Fetch LLVM sources
96
- uses : actions/checkout@v4
109
+
110
+ # We need to pull the script from the main branch, so that we ensure
111
+ # we get the latest version of this script.
112
+ - name : Fetch code formatting utils
113
+ uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
97
114
with :
98
- fetch-depth : 2
99
- path : build/main_src
115
+ repository : microsoft/DirectXShaderCompiler
116
+ ref : ${{ github.base_ref }}
117
+ sparse-checkout : |
118
+ utils/git/requirements_formatting.txt
119
+ utils/git/code-format-helper.py
120
+ utils/git/code-format-save-diff.py
121
+ sparse-checkout-cone-mode : false
122
+ path : code-format-tools
100
123
101
124
- name : Setup Python env
102
125
uses : actions/setup-python@v4
103
126
with :
104
127
python-version : ' 3.11'
105
128
cache : ' pip'
106
- cache-dependency-path : ' build/main_src /utils/git/requirements_formatting.txt'
129
+ cache-dependency-path : ' code-format-tools /utils/git/requirements_formatting.txt'
107
130
108
131
- name : Install python dependencies
109
- run : pip install -r build/main_src /utils/git/requirements_formatting.txt
132
+ run : pip install -r code-format-tools /utils/git/requirements_formatting.txt
110
133
111
134
- name : Apply code diff
112
135
env :
113
136
GITHUB_PR_NUMBER : ${{ github.event.issue.number }}
114
137
COMMENT_ID : ${{ github.event.comment.id }}
115
138
run : |
116
- python build/main_src /utils/git/code-format-save-diff.py \
139
+ python code-format-tools /utils/git/code-format-save-diff.py \
117
140
--token ${{ secrets.GITHUB_TOKEN }} \
118
141
--issue-number $GITHUB_PR_NUMBER \
119
142
--tmp-diff-file $TMP_DIFF_FILE \
0 commit comments