Skip to content

Commit 20a502d

Browse files
Another fix attempt (exercism#201)
1 parent 114e884 commit 20a502d

File tree

1 file changed

+20
-8
lines changed

1 file changed

+20
-8
lines changed

.github/workflows/check-no-important-files-changed.yml

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,22 @@ jobs:
2828
const { owner, repo } = context.repo;
2929
const pull_number = context.issue.number
3030
31-
return github.rest.pulls.listFiles({ owner, repo, pull_number })
31+
return github.rest.pulls
32+
.listFiles({ owner, repo, pull_number })
3233
.then(async ({ data: files }) => {
33-
const filenames = files.filter(file => file.status !== "added").map(file => file.filename);
34+
const filenames = files
35+
.filter((file) => file.status !== "added")
36+
.map((file) => file.filename);
3437
console.log(`Files in PR: ${filenames}`);
3538
3639
// Cache the parsed exercise config file's invalidator files
3740
let exerciseInvalidatorFiles = {};
3841
39-
return filenames.some(async (filename) => {
40-
const match = /^exercises\/(?<type>practice|concept)\/(?<slug>[^\/]+)\/(?<path>.+)$/i.exec(filename);
42+
for (const filename of filenames) {
43+
const match =
44+
/^exercises\/(?<type>practice|concept)\/(?<slug>[^\/]+)\/(?<path>.+)$/i.exec(
45+
filename
46+
);
4147
if (match?.groups === undefined) {
4248
console.log(`${filename}: skipped (can't invalidate test results)`);
4349
return false;
@@ -49,7 +55,9 @@ jobs:
4955
const parseInvalidatorFiles = (path) => {
5056
return github.rest.repos
5157
.getContent({ owner, repo, path })
52-
.then(({ data: { content } }) => JSON.parse(Buffer.from(content, "base64").toString()))
58+
.then(({ data: { content } }) =>
59+
JSON.parse(Buffer.from(content, "base64").toString())
60+
)
5361
.then((config) => {
5462
const files = config.files;
5563
if (files === undefined) {
@@ -65,8 +73,10 @@ jobs:
6573
.catch((err) => []);
6674
};
6775
68-
exerciseInvalidatorFiles[slug] ||= await parseInvalidatorFiles(configFile);
69-
const invalidatesTests = exerciseInvalidatorFiles[slug].includes(path)
76+
exerciseInvalidatorFiles[slug] ||= await parseInvalidatorFiles(
77+
configFile
78+
);
79+
const invalidatesTests = exerciseInvalidatorFiles[slug].includes(path);
7080
7181
if (invalidatesTests) {
7282
console.log(`${filename}: invalidates test results`);
@@ -75,7 +85,9 @@ jobs:
7585
}
7686
7787
return invalidatesTests;
78-
});
88+
}
89+
90+
return false;
7991
})
8092
.catch((err) => false);
8193

0 commit comments

Comments
 (0)