Skip to content

Commit 9302c72

Browse files
committed
Add filters configuration
1 parent f47d7b0 commit 9302c72

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/configuration.mjs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
const readEnv = (variable) => {
2+
const val = process.env[variable];
3+
if (val === undefined || val.length === 0) return undefined;
4+
return val;
5+
};
6+
17
const mustReadEnv = (variable) => {
28
const val = process.env[variable];
39
if (val === undefined || val.length === 0) {
@@ -21,6 +27,8 @@ function readInt(variable) {
2127

2228
export function configuration() {
2329
const defaultDelay = 3600;
30+
const defaultInclude = "*";
31+
const defaultExclude = "";
2432
const config = {
2533
github: {
2634
username: mustReadEnv("GITHUB_USERNAME"),
@@ -34,6 +42,8 @@ export function configuration() {
3442
},
3543
dryRun: readBoolean("DRY_RUN"),
3644
delay: readInt("DELAY") ?? defaultDelay,
45+
include: (readEnv("INCLUDE") ?? defaultInclude).split(",").map(f => f.trim()),
46+
exclude: (readEnv("EXCLUDE") ?? defaultExclude).split(",").map(f => f.trim()),
3747
};
3848

3949
if (config.github.privateRepositories && config.github.token === undefined) {

0 commit comments

Comments
 (0)