@actions/glob 0.2.1 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/glob.d.ts +3 -1
- package/lib/glob.js +4 -2
- package/lib/glob.js.map +1 -1
- package/lib/internal-hash-files.d.ts +1 -1
- package/lib/internal-hash-files.js +10 -7
- package/lib/internal-hash-files.js.map +1 -1
- package/package.json +2 -2
package/lib/glob.d.ts
CHANGED
|
@@ -13,6 +13,8 @@ export declare function create(patterns: string, options?: GlobOptions): Promise
|
|
|
13
13
|
* Computes the sha256 hash of a glob
|
|
14
14
|
*
|
|
15
15
|
* @param patterns Patterns separated by newlines
|
|
16
|
+
* @param currentWorkspace Workspace used when matching files
|
|
16
17
|
* @param options Glob options
|
|
18
|
+
* @param verbose Enables verbose logging
|
|
17
19
|
*/
|
|
18
|
-
export declare function hashFiles(patterns: string, options?: HashFileOptions): Promise<string>;
|
|
20
|
+
export declare function hashFiles(patterns: string, currentWorkspace?: string, options?: HashFileOptions, verbose?: Boolean): Promise<string>;
|
package/lib/glob.js
CHANGED
|
@@ -28,16 +28,18 @@ exports.create = create;
|
|
|
28
28
|
* Computes the sha256 hash of a glob
|
|
29
29
|
*
|
|
30
30
|
* @param patterns Patterns separated by newlines
|
|
31
|
+
* @param currentWorkspace Workspace used when matching files
|
|
31
32
|
* @param options Glob options
|
|
33
|
+
* @param verbose Enables verbose logging
|
|
32
34
|
*/
|
|
33
|
-
function hashFiles(patterns, options) {
|
|
35
|
+
function hashFiles(patterns, currentWorkspace = '', options, verbose = false) {
|
|
34
36
|
return __awaiter(this, void 0, void 0, function* () {
|
|
35
37
|
let followSymbolicLinks = true;
|
|
36
38
|
if (options && typeof options.followSymbolicLinks === 'boolean') {
|
|
37
39
|
followSymbolicLinks = options.followSymbolicLinks;
|
|
38
40
|
}
|
|
39
41
|
const globber = yield create(patterns, { followSymbolicLinks });
|
|
40
|
-
return internal_hash_files_1.hashFiles(globber);
|
|
42
|
+
return internal_hash_files_1.hashFiles(globber, currentWorkspace, verbose);
|
|
41
43
|
});
|
|
42
44
|
}
|
|
43
45
|
exports.hashFiles = hashFiles;
|
package/lib/glob.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"glob.js","sourceRoot":"","sources":["../src/glob.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yDAA0D;AAG1D,+DAA6D;AAI7D;;;;;GAKG;AACH,SAAsB,MAAM,CAC1B,QAAgB,EAChB,OAAqB;;QAErB,OAAO,MAAM,iCAAc,CAAC,MAAM,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAA;IACvD,CAAC;CAAA;AALD,wBAKC;AAED
|
|
1
|
+
{"version":3,"file":"glob.js","sourceRoot":"","sources":["../src/glob.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yDAA0D;AAG1D,+DAA6D;AAI7D;;;;;GAKG;AACH,SAAsB,MAAM,CAC1B,QAAgB,EAChB,OAAqB;;QAErB,OAAO,MAAM,iCAAc,CAAC,MAAM,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAA;IACvD,CAAC;CAAA;AALD,wBAKC;AAED;;;;;;;GAOG;AACH,SAAsB,SAAS,CAC7B,QAAgB,EAChB,gBAAgB,GAAG,EAAE,EACrB,OAAyB,EACzB,UAAmB,KAAK;;QAExB,IAAI,mBAAmB,GAAG,IAAI,CAAA;QAC9B,IAAI,OAAO,IAAI,OAAO,OAAO,CAAC,mBAAmB,KAAK,SAAS,EAAE;YAC/D,mBAAmB,GAAG,OAAO,CAAC,mBAAmB,CAAA;SAClD;QACD,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,QAAQ,EAAE,EAAC,mBAAmB,EAAC,CAAC,CAAA;QAC7D,OAAO,+BAAU,CAAC,OAAO,EAAE,gBAAgB,EAAE,OAAO,CAAC,CAAA;IACvD,CAAC;CAAA;AAZD,8BAYC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { Globber } from './glob';
|
|
2
|
-
export declare function hashFiles(globber: Globber): Promise<string>;
|
|
2
|
+
export declare function hashFiles(globber: Globber, currentWorkspace: string, verbose?: Boolean): Promise<string>;
|
|
@@ -42,24 +42,27 @@ const fs = __importStar(require("fs"));
|
|
|
42
42
|
const stream = __importStar(require("stream"));
|
|
43
43
|
const util = __importStar(require("util"));
|
|
44
44
|
const path = __importStar(require("path"));
|
|
45
|
-
function hashFiles(globber) {
|
|
45
|
+
function hashFiles(globber, currentWorkspace, verbose = false) {
|
|
46
46
|
var e_1, _a;
|
|
47
47
|
var _b;
|
|
48
48
|
return __awaiter(this, void 0, void 0, function* () {
|
|
49
|
+
const writeDelegate = verbose ? core.info : core.debug;
|
|
49
50
|
let hasMatch = false;
|
|
50
|
-
const githubWorkspace =
|
|
51
|
+
const githubWorkspace = currentWorkspace
|
|
52
|
+
? currentWorkspace
|
|
53
|
+
: (_b = process.env['GITHUB_WORKSPACE']) !== null && _b !== void 0 ? _b : process.cwd();
|
|
51
54
|
const result = crypto.createHash('sha256');
|
|
52
55
|
let count = 0;
|
|
53
56
|
try {
|
|
54
57
|
for (var _c = __asyncValues(globber.globGenerator()), _d; _d = yield _c.next(), !_d.done;) {
|
|
55
58
|
const file = _d.value;
|
|
56
|
-
|
|
59
|
+
writeDelegate(file);
|
|
57
60
|
if (!file.startsWith(`${githubWorkspace}${path.sep}`)) {
|
|
58
|
-
|
|
61
|
+
writeDelegate(`Ignore '${file}' since it is not under GITHUB_WORKSPACE.`);
|
|
59
62
|
continue;
|
|
60
63
|
}
|
|
61
64
|
if (fs.statSync(file).isDirectory()) {
|
|
62
|
-
|
|
65
|
+
writeDelegate(`Skip directory '${file}'.`);
|
|
63
66
|
continue;
|
|
64
67
|
}
|
|
65
68
|
const hash = crypto.createHash('sha256');
|
|
@@ -81,11 +84,11 @@ function hashFiles(globber) {
|
|
|
81
84
|
}
|
|
82
85
|
result.end();
|
|
83
86
|
if (hasMatch) {
|
|
84
|
-
|
|
87
|
+
writeDelegate(`Found ${count} files to hash.`);
|
|
85
88
|
return result.digest('hex');
|
|
86
89
|
}
|
|
87
90
|
else {
|
|
88
|
-
|
|
91
|
+
writeDelegate(`No matches found for glob`);
|
|
89
92
|
return '';
|
|
90
93
|
}
|
|
91
94
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal-hash-files.js","sourceRoot":"","sources":["../src/internal-hash-files.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAgC;AAChC,oDAAqC;AACrC,uCAAwB;AACxB,+CAAgC;AAChC,2CAA4B;AAC5B,2CAA4B;AAG5B,SAAsB,SAAS,
|
|
1
|
+
{"version":3,"file":"internal-hash-files.js","sourceRoot":"","sources":["../src/internal-hash-files.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAgC;AAChC,oDAAqC;AACrC,uCAAwB;AACxB,+CAAgC;AAChC,2CAA4B;AAC5B,2CAA4B;AAG5B,SAAsB,SAAS,CAC7B,OAAgB,EAChB,gBAAwB,EACxB,UAAmB,KAAK;;;;QAExB,MAAM,aAAa,GAAG,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAA;QACtD,IAAI,QAAQ,GAAG,KAAK,CAAA;QACpB,MAAM,eAAe,GAAG,gBAAgB;YACtC,CAAC,CAAC,gBAAgB;YAClB,CAAC,OAAC,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,mCAAI,OAAO,CAAC,GAAG,EAAE,CAAA;QACpD,MAAM,MAAM,GAAG,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAA;QAC1C,IAAI,KAAK,GAAG,CAAC,CAAA;;YACb,KAAyB,IAAA,KAAA,cAAA,OAAO,CAAC,aAAa,EAAE,CAAA,IAAA;gBAArC,MAAM,IAAI,WAAA,CAAA;gBACnB,aAAa,CA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-37,7 +37,7 @@
|
|
|
37
37
|
"url": "https://github.com/actions/toolkit/issues"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@actions/core": "^1.
|
|
40
|
+
"@actions/core": "^1.9.1",
|
|
41
41
|
"minimatch": "^3.0.4"
|
|
42
42
|
}
|
|
43
43
|
}
|