Skip to content

Commit

Permalink
Test fix script
Browse files Browse the repository at this point in the history
  • Loading branch information
mrruby committed Jan 30, 2024
1 parent 7da4f90 commit 9ac1907
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,30 @@ jobs:
name: test

steps:
- name: Check version against latest release in Chrome Web Store
id: check_version
uses: actions/github-script@v6
with:
script: |
const fs = require('fs');
const fetch = require('node-fetch');
const manifest = JSON.parse(fs.readFileSync('./static/manifest.json', 'utf8'));
const currentVersion = manifest.version;
const response = await fetch(`https://chrome.google.com/webstore/detail/${{ secrets.CHROME_CLIENT_ID }}?hl=en`);
const text = await response.text();
const match = text.match(/"version": "(\d+\.\d+\.\d+)"/);
const latestVersion = match ? match[1] : null;
if (currentVersion === latestVersion) {
core.setOutput('abort', 'true');
} else {
core.setOutput('abort', 'false');
}
- name: Abort build if version matches
if: steps.check_version.outputs.abort == 'true'
run: |
echo "Version in manifest matches the latest release version in Chrome Web Store. Aborting build."
exit 1
- uses: actions/checkout@v4

- name: Setup Node.js environment
uses: actions/setup-node@v3
with:
Expand Down

0 comments on commit 9ac1907

Please sign in to comment.