Skip to content

Commit 008ba8c

Browse files
feat: add matrix alias to simplify using outputs for matrix jobs (#1975)
Co-authored-by: GitHub Action <[email protected]>
1 parent fe6c3ea commit 008ba8c

File tree

8 files changed

+520
-9
lines changed

8 files changed

+520
-9
lines changed

.github/workflows/matrix-example.yml

+1-2
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@ jobs:
2424
id: changed-files
2525
uses: ./
2626
with:
27-
json: true
28-
escape_json: false
27+
matrix: true
2928
- name: List all changed files
3029
run: echo '${{ steps.changed-files.outputs.all_changed_files }}'
3130

action.yml

+4
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,10 @@ inputs:
219219
description: "Apply the negation patterns first. NOTE: This affects how changed files are matched."
220220
required: false
221221
default: "false"
222+
matrix:
223+
description: "Output changed files in a format that can be used for matrix jobs. Alias for setting inputs `json` to `true` and `escape_json` to `false`."
224+
required: false
225+
default: "false"
222226

223227
outputs:
224228
added_files:

dist/index.js

+8-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,343 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`getInputs should correctly parse boolean inputs 1`] = `
4+
{
5+
"apiUrl": undefined,
6+
"baseSha": undefined,
7+
"diffRelative": "false",
8+
"dirNames": "false",
9+
"dirNamesDeletedFilesIncludeOnlyDeletedDirs": "false",
10+
"dirNamesExcludeCurrentDir": "false",
11+
"dirNamesIncludeFiles": undefined,
12+
"dirNamesIncludeFilesSeparator": undefined,
13+
"escapeJson": false,
14+
"failOnInitialDiffError": "false",
15+
"failOnSubmoduleDiffError": "false",
16+
"fetchAdditionalSubmoduleHistory": "false",
17+
"files": undefined,
18+
"filesFromSourceFile": undefined,
19+
"filesFromSourceFileSeparator": undefined,
20+
"filesIgnore": undefined,
21+
"filesIgnoreFromSourceFile": undefined,
22+
"filesIgnoreFromSourceFileSeparator": undefined,
23+
"filesIgnoreSeparator": undefined,
24+
"filesIgnoreYaml": undefined,
25+
"filesIgnoreYamlFromSourceFile": undefined,
26+
"filesIgnoreYamlFromSourceFileSeparator": undefined,
27+
"filesSeparator": undefined,
28+
"filesYaml": undefined,
29+
"filesYamlFromSourceFile": undefined,
30+
"filesYamlFromSourceFileSeparator": undefined,
31+
"includeAllOldNewRenamedFiles": "false",
32+
"json": true,
33+
"negationPatternsFirst": "false",
34+
"oldNewFilesSeparator": undefined,
35+
"oldNewSeparator": undefined,
36+
"outputDir": undefined,
37+
"outputRenamedFilesAsDeletedAndAdded": "false",
38+
"path": undefined,
39+
"quotepath": "false",
40+
"recoverDeletedFiles": "false",
41+
"recoverDeletedFilesToDestination": undefined,
42+
"recoverFiles": undefined,
43+
"recoverFilesIgnore": undefined,
44+
"recoverFilesIgnoreSeparator": undefined,
45+
"recoverFilesSeparator": undefined,
46+
"safeOutput": "false",
47+
"separator": undefined,
48+
"sha": undefined,
49+
"since": undefined,
50+
"sinceLastRemoteCommit": "false",
51+
"skipInitialFetch": "true",
52+
"token": undefined,
53+
"until": undefined,
54+
"useRestApi": "false",
55+
"writeOutputFiles": "false",
56+
}
57+
`;
58+
59+
exports[`getInputs should correctly parse numeric inputs 1`] = `
60+
{
61+
"apiUrl": "",
62+
"baseSha": "",
63+
"diffRelative": true,
64+
"dirNames": false,
65+
"dirNamesDeletedFilesIncludeOnlyDeletedDirs": false,
66+
"dirNamesExcludeCurrentDir": false,
67+
"dirNamesIncludeFiles": "",
68+
"dirNamesIncludeFilesSeparator": "",
69+
"dirNamesMaxDepth": 2,
70+
"escapeJson": false,
71+
"failOnInitialDiffError": false,
72+
"failOnSubmoduleDiffError": false,
73+
"fetchAdditionalSubmoduleHistory": false,
74+
"fetchDepth": 5,
75+
"files": "",
76+
"filesFromSourceFile": "",
77+
"filesFromSourceFileSeparator": "",
78+
"filesIgnore": "",
79+
"filesIgnoreFromSourceFile": "",
80+
"filesIgnoreFromSourceFileSeparator": "",
81+
"filesIgnoreSeparator": "",
82+
"filesIgnoreYaml": "",
83+
"filesIgnoreYamlFromSourceFile": "",
84+
"filesIgnoreYamlFromSourceFileSeparator": "",
85+
"filesSeparator": "",
86+
"filesYaml": "",
87+
"filesYamlFromSourceFile": "",
88+
"filesYamlFromSourceFileSeparator": "",
89+
"includeAllOldNewRenamedFiles": false,
90+
"json": false,
91+
"negationPatternsFirst": false,
92+
"oldNewFilesSeparator": "",
93+
"oldNewSeparator": "",
94+
"outputDir": "",
95+
"outputRenamedFilesAsDeletedAndAdded": false,
96+
"path": "",
97+
"quotepath": true,
98+
"recoverDeletedFiles": false,
99+
"recoverDeletedFilesToDestination": "",
100+
"recoverFiles": "",
101+
"recoverFilesIgnore": "",
102+
"recoverFilesIgnoreSeparator": "",
103+
"recoverFilesSeparator": "",
104+
"safeOutput": false,
105+
"separator": "",
106+
"sha": "",
107+
"since": "",
108+
"sinceLastRemoteCommit": false,
109+
"skipInitialFetch": false,
110+
"token": "",
111+
"until": "",
112+
"useRestApi": false,
113+
"writeOutputFiles": false,
114+
}
115+
`;
116+
117+
exports[`getInputs should correctly parse string inputs 1`] = `
118+
{
119+
"apiUrl": "https://api.github.com",
120+
"baseSha": "",
121+
"diffRelative": true,
122+
"dirNames": false,
123+
"dirNamesDeletedFilesIncludeOnlyDeletedDirs": false,
124+
"dirNamesExcludeCurrentDir": false,
125+
"dirNamesIncludeFiles": "",
126+
"dirNamesIncludeFilesSeparator": "",
127+
"escapeJson": false,
128+
"failOnInitialDiffError": false,
129+
"failOnSubmoduleDiffError": false,
130+
"fetchAdditionalSubmoduleHistory": false,
131+
"files": "",
132+
"filesFromSourceFile": "",
133+
"filesFromSourceFileSeparator": "",
134+
"filesIgnore": "",
135+
"filesIgnoreFromSourceFile": "",
136+
"filesIgnoreFromSourceFileSeparator": "",
137+
"filesIgnoreSeparator": "",
138+
"filesIgnoreYaml": "",
139+
"filesIgnoreYamlFromSourceFile": "",
140+
"filesIgnoreYamlFromSourceFileSeparator": "",
141+
"filesSeparator": "",
142+
"filesYaml": "",
143+
"filesYamlFromSourceFile": "",
144+
"filesYamlFromSourceFileSeparator": "",
145+
"includeAllOldNewRenamedFiles": false,
146+
"json": false,
147+
"negationPatternsFirst": false,
148+
"oldNewFilesSeparator": "",
149+
"oldNewSeparator": "",
150+
"outputDir": "",
151+
"outputRenamedFilesAsDeletedAndAdded": false,
152+
"path": "",
153+
"quotepath": true,
154+
"recoverDeletedFiles": false,
155+
"recoverDeletedFilesToDestination": "",
156+
"recoverFiles": "",
157+
"recoverFilesIgnore": "",
158+
"recoverFilesIgnoreSeparator": "",
159+
"recoverFilesSeparator": "",
160+
"safeOutput": false,
161+
"separator": "",
162+
"sha": "",
163+
"since": "",
164+
"sinceLastRemoteCommit": false,
165+
"skipInitialFetch": false,
166+
"token": "token",
167+
"until": "",
168+
"useRestApi": false,
169+
"writeOutputFiles": false,
170+
}
171+
`;
172+
173+
exports[`getInputs should handle invalid numeric inputs correctly 1`] = `
174+
{
175+
"apiUrl": "",
176+
"baseSha": "",
177+
"diffRelative": true,
178+
"dirNames": false,
179+
"dirNamesDeletedFilesIncludeOnlyDeletedDirs": false,
180+
"dirNamesExcludeCurrentDir": false,
181+
"dirNamesIncludeFiles": "",
182+
"dirNamesIncludeFilesSeparator": "",
183+
"dirNamesMaxDepth": 2,
184+
"escapeJson": false,
185+
"failOnInitialDiffError": false,
186+
"failOnSubmoduleDiffError": false,
187+
"fetchAdditionalSubmoduleHistory": false,
188+
"fetchDepth": NaN,
189+
"files": "",
190+
"filesFromSourceFile": "",
191+
"filesFromSourceFileSeparator": "",
192+
"filesIgnore": "",
193+
"filesIgnoreFromSourceFile": "",
194+
"filesIgnoreFromSourceFileSeparator": "",
195+
"filesIgnoreSeparator": "",
196+
"filesIgnoreYaml": "",
197+
"filesIgnoreYamlFromSourceFile": "",
198+
"filesIgnoreYamlFromSourceFileSeparator": "",
199+
"filesSeparator": "",
200+
"filesYaml": "",
201+
"filesYamlFromSourceFile": "",
202+
"filesYamlFromSourceFileSeparator": "",
203+
"includeAllOldNewRenamedFiles": false,
204+
"json": false,
205+
"negationPatternsFirst": false,
206+
"oldNewFilesSeparator": "",
207+
"oldNewSeparator": "",
208+
"outputDir": "",
209+
"outputRenamedFilesAsDeletedAndAdded": false,
210+
"path": "",
211+
"quotepath": true,
212+
"recoverDeletedFiles": false,
213+
"recoverDeletedFilesToDestination": "",
214+
"recoverFiles": "",
215+
"recoverFilesIgnore": "",
216+
"recoverFilesIgnoreSeparator": "",
217+
"recoverFilesSeparator": "",
218+
"safeOutput": false,
219+
"separator": "",
220+
"sha": "",
221+
"since": "",
222+
"sinceLastRemoteCommit": false,
223+
"skipInitialFetch": false,
224+
"token": "",
225+
"until": "",
226+
"useRestApi": false,
227+
"writeOutputFiles": false,
228+
}
229+
`;
230+
231+
exports[`getInputs should handle negative numeric inputs correctly 1`] = `
232+
{
233+
"apiUrl": "",
234+
"baseSha": "",
235+
"diffRelative": true,
236+
"dirNames": false,
237+
"dirNamesDeletedFilesIncludeOnlyDeletedDirs": false,
238+
"dirNamesExcludeCurrentDir": false,
239+
"dirNamesIncludeFiles": "",
240+
"dirNamesIncludeFilesSeparator": "",
241+
"dirNamesMaxDepth": -2,
242+
"escapeJson": false,
243+
"failOnInitialDiffError": false,
244+
"failOnSubmoduleDiffError": false,
245+
"fetchAdditionalSubmoduleHistory": false,
246+
"fetchDepth": 2,
247+
"files": "",
248+
"filesFromSourceFile": "",
249+
"filesFromSourceFileSeparator": "",
250+
"filesIgnore": "",
251+
"filesIgnoreFromSourceFile": "",
252+
"filesIgnoreFromSourceFileSeparator": "",
253+
"filesIgnoreSeparator": "",
254+
"filesIgnoreYaml": "",
255+
"filesIgnoreYamlFromSourceFile": "",
256+
"filesIgnoreYamlFromSourceFileSeparator": "",
257+
"filesSeparator": "",
258+
"filesYaml": "",
259+
"filesYamlFromSourceFile": "",
260+
"filesYamlFromSourceFileSeparator": "",
261+
"includeAllOldNewRenamedFiles": false,
262+
"json": false,
263+
"negationPatternsFirst": false,
264+
"oldNewFilesSeparator": "",
265+
"oldNewSeparator": "",
266+
"outputDir": "",
267+
"outputRenamedFilesAsDeletedAndAdded": false,
268+
"path": "",
269+
"quotepath": true,
270+
"recoverDeletedFiles": false,
271+
"recoverDeletedFilesToDestination": "",
272+
"recoverFiles": "",
273+
"recoverFilesIgnore": "",
274+
"recoverFilesIgnoreSeparator": "",
275+
"recoverFilesSeparator": "",
276+
"safeOutput": false,
277+
"separator": "",
278+
"sha": "",
279+
"since": "",
280+
"sinceLastRemoteCommit": false,
281+
"skipInitialFetch": false,
282+
"token": "",
283+
"until": "",
284+
"useRestApi": false,
285+
"writeOutputFiles": false,
286+
}
287+
`;
288+
289+
exports[`getInputs should return default values when no inputs are provided 1`] = `
290+
{
291+
"apiUrl": undefined,
292+
"baseSha": undefined,
293+
"diffRelative": true,
294+
"dirNames": false,
295+
"dirNamesDeletedFilesIncludeOnlyDeletedDirs": false,
296+
"dirNamesExcludeCurrentDir": false,
297+
"dirNamesIncludeFiles": undefined,
298+
"dirNamesIncludeFilesSeparator": undefined,
299+
"escapeJson": false,
300+
"failOnInitialDiffError": false,
301+
"failOnSubmoduleDiffError": false,
302+
"fetchAdditionalSubmoduleHistory": false,
303+
"files": undefined,
304+
"filesFromSourceFile": undefined,
305+
"filesFromSourceFileSeparator": undefined,
306+
"filesIgnore": undefined,
307+
"filesIgnoreFromSourceFile": undefined,
308+
"filesIgnoreFromSourceFileSeparator": undefined,
309+
"filesIgnoreSeparator": undefined,
310+
"filesIgnoreYaml": undefined,
311+
"filesIgnoreYamlFromSourceFile": undefined,
312+
"filesIgnoreYamlFromSourceFileSeparator": undefined,
313+
"filesSeparator": undefined,
314+
"filesYaml": undefined,
315+
"filesYamlFromSourceFile": undefined,
316+
"filesYamlFromSourceFileSeparator": undefined,
317+
"includeAllOldNewRenamedFiles": false,
318+
"json": false,
319+
"negationPatternsFirst": false,
320+
"oldNewFilesSeparator": undefined,
321+
"oldNewSeparator": undefined,
322+
"outputDir": undefined,
323+
"outputRenamedFilesAsDeletedAndAdded": false,
324+
"path": undefined,
325+
"quotepath": true,
326+
"recoverDeletedFiles": false,
327+
"recoverDeletedFilesToDestination": undefined,
328+
"recoverFiles": undefined,
329+
"recoverFilesIgnore": undefined,
330+
"recoverFilesIgnoreSeparator": undefined,
331+
"recoverFilesSeparator": undefined,
332+
"safeOutput": false,
333+
"separator": undefined,
334+
"sha": undefined,
335+
"since": undefined,
336+
"sinceLastRemoteCommit": false,
337+
"skipInitialFetch": false,
338+
"token": undefined,
339+
"until": undefined,
340+
"useRestApi": false,
341+
"writeOutputFiles": false,
342+
}
343+
`;

0 commit comments

Comments
 (0)