Skip to content

Commit

Permalink
Merge pull request #15 from DeckThemes/dev
Browse files Browse the repository at this point in the history
chore: auto-update now works
  • Loading branch information
Tormak9970 authored Aug 20, 2023
2 parents 6e92bd6 + 5760015 commit 4057885
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/checkForUpdates.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Check for Updates

on:
schedule:
- cron: "12 0 * * 0" # Run every Sunday at 12:00 AM
- cron: "00 0 * * 0" # Run every Sunday at 12:00 AM
workflow_dispatch:

jobs:
Expand All @@ -26,7 +26,7 @@ jobs:
ref: main

- name: Check DeckThemes API
uses: actions/github-script@v3
uses: actions/github-script@v6
with:
script: |
const fs = require("fs");
Expand Down Expand Up @@ -104,24 +104,24 @@ jobs:
const data = await response.json();
//? Check for New Targets
const listFromSchema = schema.properties.targets.enum;
const listFromSchema = schema.properties.target.enum;
const listFromApi = Object.keys(data.filters);
//TODO: check for differences
const listsAreEqual = listFromSchema.every((elem) => listFromApi.includes(elem)) && listFromApi.every((elem) => listFromSchema.includes(elem));
if (!listsAreEqual) {
newTargets = true;
schema.properties.targets.enum = listFromApi;
schema.properties.target.enum = listFromApi;
}
const mainPyPath = path.join(cwdPath, "css-loader", "SDH-CssLoader", "main.py");
const mainPyContents = fs.readFileSync(mainPyPath, 'utf8');
const themePyPath = path.join(cwdPath, "css-loader", "css_theme.py");
const themePyContents = fs.readFileSync(themePyPath, 'utf8');
const manifestVersionPattern = /CSS_LOADER_VER = (.*)/;
//? Check for New Manifest Version
const currentVersion = schema.properties.manifest_version.const;
const newVersionStr = mainPyContents.match(manifestVersionPattern)[0];
const newVersionStr = themePyContents.match(manifestVersionPattern)[1];
const newVersion = parseInt(newVersionStr);
if (currentVersion !== newVersion) {
Expand Down

0 comments on commit 4057885

Please sign in to comment.