From ad4889c2082c5352a194724cb2b3cb781b7bca60 Mon Sep 17 00:00:00 2001 From: Dawid Urbas Date: Thu, 29 Feb 2024 17:55:24 +0000 Subject: [PATCH] Fix action --- .github/workflows/test.yaml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index a1847c3..d43fdf3 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -22,22 +22,22 @@ jobs: with: script: | const fs = require('fs/promises'); - fs.readFile('./static/manifest.json', 'utf8') - .then(data => { + const fetchVersionInfo = async () => { + try { + const data = await fs.readFile('./static/manifest.json', 'utf8'); const manifest = JSON.parse(data); const currentVersion = manifest.version; - return fetch(`https://chromewebstore.google.com/detail/holo-key-manager/${{ secrets.CHROME_ID }}`) - }) - .then(response => response.text()) - .then(text => { + const response = await fetch(`https://chromewebstore.google.com/detail/holo-key-manager/${process.env.CHROME_ID}`); + const text = await response.text(); const versionPattern = /]*>Version<\/div>]*>(\d+\.\d+\.\d+)<\/div>/; const versionMatch = text.match(versionPattern); const latestVersion = versionMatch ? versionMatch[1] : null; core.setOutput('abort', currentVersion === latestVersion ? 'true' : 'false'); - }) - .catch(error => { + } catch (error) { core.setFailed(error.message); - }); + } + }; + fetchVersionInfo(); - name: Abort build if version matches if: steps.check_version.outputs.abort == 'true' run: |