Skip to content

Commit 605fb36

Browse files
committed
dev: fix empty matching bug
1 parent 0b9f123 commit 605fb36

File tree

3 files changed

+34
-1
lines changed

3 files changed

+34
-1
lines changed

README.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ npm test # Run unit tests
2626

2727
### Run integration test
2828

29+
#### If target is readable-readme
30+
2931
Integration test will run a full scan on the current directory like the installed GitHub actions.
3032

3133
```bash
@@ -34,10 +36,21 @@ export GITHUB_TOKEN=[the GitHub identity you want to use]
3436
npm start
3537
```
3638

39+
#### If target is another repository
40+
41+
> for now, the remote repository must be public
42+
43+
```bash
44+
export GITHUB_REPOSITORY=username/repo
45+
source ./script/setupRemoteTest.sh
46+
export GITHUB_TOKEN=[the GitHub identity you want to use]
47+
npm start
48+
```
49+
3750
### Build lib
3851

3952
```bash
40-
npm run build
53+
npm run build # The compiled code will be in ./lib
4154
```
4255

4356
## Roadmap

script/setupRemoteTest.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# GITHUB_REPOSITORY has to be set before running this script
2+
3+
export REMOTE_TEST_DIR=/tmp/readable-readme-test
4+
export GITHUB_REF=refs/heads/master
5+
export GITHUB_WORKFLOW=test_workflow
6+
export GITHUB_ACTION=readable-readme
7+
export RRLOG=false
8+
9+
mkdir -p ${REMOTE_TEST_DIR}
10+
git clone https://github.com/${GITHUB_REPOSITORY}.git ${REMOTE_TEST_DIR}/${GITHUB_REPOSITORY}
11+
12+
export GITHUB_WORKSPACE=${REMOTE_TEST_DIR}/${GITHUB_REPOSITORY}

src/util.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,15 @@ export function getLintFileList(workspaceDir: string): string[] {
285285
// TODO(tianhaoz95): add test for this.
286286
const readmeIgnoreFilename = path.join(workspaceDir, "/.readmeignore");
287287
const ignoreList = getReadmeIgnoreList(readmeIgnoreFilename);
288+
rrlog("ignore list found: " + JSON.stringify(ignoreList));
288289
const rawWorkspaceFiles = listFiles(workspaceDir);
290+
rrlog("rawWorkspaceFiles size: " + rawWorkspaceFiles.length.toString());
291+
if (ignoreList.length === 0) {
292+
// match with empty ignorelist will return empty list, so just return
293+
rrlog("ignorelist is empty, proceed with all markdown files");
294+
return rawWorkspaceFiles;
295+
}
289296
const workspaceFiles = micromatch(rawWorkspaceFiles, ignoreList);
297+
rrlog("workspaceFiles size: " + workspaceFiles.length.toString());
290298
return workspaceFiles;
291299
}

0 commit comments

Comments
 (0)