Skip to content

Commit 8cf5003

Browse files
authored
Merge branch 'SQLab:312551178' into 312551178
2 parents f35c9d0 + 033f080 commit 8cf5003

File tree

5 files changed

+60
-6
lines changed

5 files changed

+60
-6
lines changed

.github/pull_request_template.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
## Description
22

3+
<!-- You can check sample PR here: (remember delete this link when you create your PR) -->
4+
<https://github.com/SQLab/112-spring-software-testing/pull/2>
5+
36
<!-- Please briefly describe your change here -->
47

58
---
69

710
<!-- Please make sure you're satisfy and fill the following checkboxes -->
811
<!-- A good PR should include the following parts: -->
912

10-
- [ ] A clear title
13+
- [ ] A clear title (name your pr "[LAB{lab_number}] {your_student_id}")
1114
- [ ] A meaningful message for PR, as well as its commits
12-
- [ ] From your specific branch (***not master***) merging to your branch
15+
- [ ] From your specific branch (***not main or other's branch***) merging to your branch
1316
- [ ] Excluding any irrelevant files, such as binaries, text files, or dot files
1417
- [ ] Passing tests/CI
15-
- [ ] Add proper label for this PR

.github/workflows/label.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Automatic PR Labeler
2+
on:
3+
pull_request_target:
4+
types: [opened, reopened, edited]
5+
6+
jobs:
7+
labeler:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Label PR
11+
uses: actions/github-script@v5
12+
with:
13+
github-token: ${{ secrets.PAT }}
14+
script: |
15+
const { owner, repo, number: issue_number } = context.issue;
16+
const pr = await github.rest.pulls.get({ owner, repo, pull_number: issue_number });
17+
const title = pr.data.title;
18+
const labRegex = /\[LAB(\d+)\]/i;
19+
20+
const match = title.match(labRegex);
21+
if (match) {
22+
const labelToAdd = 'lab' + match[1];
23+
await github.rest.issues.addLabels({ owner, repo, issue_number, labels: [labelToAdd] });
24+
}

lab1/README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ In this lab, you will write unit tests for functions implemented in `main.js`. Y
66

77
## Requirement
88

9-
1. Write test cases in `main_test.js` and achieve 100% code coverage. (90%)
10-
2. Add a badge and make it show `passing` in `README.md` in the root folder. (10%)
9+
1. Write test cases in `main_test.js` and achieve 100% code coverage. (100%)
1110

1211
You can run `validate.sh` in your local to test if you satisfy the requirements.
1312

lab1/validate.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ cd $tmp_dir
99

1010
rm -rf *
1111
cp $solution_path/*.js .
12-
result=$($node --test --experimental-test-coverage) ; ret=$?
12+
result=$($"node" --test --experimental-test-coverage) ; ret=$?
1313
if [ $ret -ne 0 ] ; then
1414
echo "[!] testing fails"
1515
exit 1

scripts/rebase-all.sh

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/bin/bash
2+
3+
git fetch origin
4+
5+
for branch in $(git branch -r | grep -v HEAD); do
6+
# Remove the "origin/" prefix
7+
branch=${branch#origin/}
8+
9+
if [[ "$branch" != "main" ]]; then
10+
git checkout "$branch"
11+
if [[ $? -ne 0 ]]; then
12+
echo "Checkout failed for branch $branch"
13+
exit 1
14+
fi
15+
git pull origin "$branch"
16+
if [[ $? -ne 0 ]]; then
17+
echo "Pull failed for branch $branch"
18+
exit 1
19+
fi
20+
git rebase main
21+
if [[ $? -ne 0 ]]; then
22+
echo "Rebase failed for branch $branch"
23+
exit 1
24+
fi
25+
git push origin "$branch"
26+
fi
27+
done
28+
29+
git checkout main

0 commit comments

Comments
 (0)