Skip to content

Commit

Permalink
Raise error if CDN check failed
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenjoezhang committed Dec 6, 2023
1 parent 6683aae commit 26db622
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
11 changes: 10 additions & 1 deletion .github/workflows/commenter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,17 @@ jobs:
- name: Use Node.js
uses: actions/setup-node@v4
- run: npm install
- run: node lib/comment.js | tee -a results.txt
- run: |
node lib/comment.js | tee -a results.txt
- name: Comment PR
uses: marocchino/sticky-pull-request-comment@v2
with:
path: results.txt
- uses: actions/github-script@v3
with:
script: |
const fs = require('fs');
const fileContent = fs.readFileSync('results.txt', 'utf8');
if (fileContent.includes('❌')) {
core.setFailed('CDN check failed!')
}
5 changes: 2 additions & 3 deletions lib/comment.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,7 @@ async function printCDNTable() {
const version = newPlugins[name];
const links = getVendors({ ...value, version, minified: file });
const integrity = await ssri
.fromStream(fs.createReadStream(`./node_modules/${name}/${file}`), { algorithms: ['sha256'] })
.toString();
await formatTable(key, links, integrity);
.fromStream(fs.createReadStream(`./node_modules/${name}/${file}`), { algorithms: ['sha256'] });
await formatTable(key, links, integrity.toString());
}
}

0 comments on commit 26db622

Please sign in to comment.