Skip to content

Commit 22a9521

Browse files
committed
feat: an easy check for changed files
1 parent c895269 commit 22a9521

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

.github/workflows/lab-autograding.yml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,10 @@ jobs:
4444
4545
const files = await github.rest.pulls.listFiles({ owner, repo, pull_number: issue_number });
4646
const changedFiles = files.data.map((file) => file.filename);
47-
const allowedFiles = [
48-
`lab${labNumber}/main_test.js`,
49-
];
50-
// if (!changedFiles.every((file) => allowedFiles.includes(file))) {
51-
// core.setFailed('The PR contains changes to files other than the allowed files.');
52-
// }
47+
const allowedFileRegex = /^lab\d+\/main_test.js$/;
48+
if (!changedFiles.every((file) => allowedFileRegex.test(file))) {
49+
core.setFailed('The PR contains changes to files other than the allowed files.');
50+
}
5351
return labNumber;
5452
- name: Grading
5553
run: |

0 commit comments

Comments
 (0)