Skip to content

Commit 26db622

Browse files
Raise error if CDN check failed
1 parent 6683aae commit 26db622

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

.github/workflows/commenter.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,17 @@ jobs:
1212
- name: Use Node.js
1313
uses: actions/setup-node@v4
1414
- run: npm install
15-
- run: node lib/comment.js | tee -a results.txt
15+
- run: |
16+
node lib/comment.js | tee -a results.txt
1617
- name: Comment PR
1718
uses: marocchino/sticky-pull-request-comment@v2
1819
with:
1920
path: results.txt
21+
- uses: actions/github-script@v3
22+
with:
23+
script: |
24+
const fs = require('fs');
25+
const fileContent = fs.readFileSync('results.txt', 'utf8');
26+
if (fileContent.includes('❌')) {
27+
core.setFailed('CDN check failed!')
28+
}

lib/comment.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,7 @@ async function printCDNTable() {
8282
const version = newPlugins[name];
8383
const links = getVendors({ ...value, version, minified: file });
8484
const integrity = await ssri
85-
.fromStream(fs.createReadStream(`./node_modules/${name}/${file}`), { algorithms: ['sha256'] })
86-
.toString();
87-
await formatTable(key, links, integrity);
85+
.fromStream(fs.createReadStream(`./node_modules/${name}/${file}`), { algorithms: ['sha256'] });
86+
await formatTable(key, links, integrity.toString());
8887
}
8988
}

0 commit comments

Comments
 (0)