Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[LAB2] 312555001 #620

Closed
wants to merge 24 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat: an easy check for changed files
  • Loading branch information
AlaRduTP committed Mar 21, 2024
commit 9fcdccdfbf51a4a3407dcf938396d18604f67123
12 changes: 5 additions & 7 deletions .github/workflows/lab-autograding.yml
Original file line number Diff line number Diff line change
@@ -30,7 +30,7 @@ jobs:
const pr = await github.rest.pulls.get({ owner, repo, pull_number: issue_number });
const labels = pr.data.labels;
const lab = labels.find((label) => label.name.startsWith('lab'));
if (!lab) {
if (!lab) {
core.setFailed('No lab label found on the PR.');
return { number: 0 };
}
@@ -44,12 +44,10 @@ jobs:

const files = await github.rest.pulls.listFiles({ owner, repo, pull_number: issue_number });
const changedFiles = files.data.map((file) => file.filename);
const allowedFiles = [
`lab${labNumber}/main_test.js`,
];
// if (!changedFiles.every((file) => allowedFiles.includes(file))) {
// core.setFailed('The PR contains changes to files other than the allowed files.');
// }
const allowedFileRegex = /^lab\d+\/main_test.js$/;
if (!changedFiles.every((file) => allowedFileRegex.test(file))) {
core.setFailed('The PR contains changes to files other than the allowed files.');
}
return labNumber;
- name: Grading
run: |