Skip to content

Commit 9e3e79b

Browse files
committed
Update API workflow + limit to last 10 versions to check
1 parent 68750a0 commit 9e3e79b

2 files changed

Lines changed: 21 additions & 3 deletions

File tree

.github/workflows/update-api.yaml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,23 @@
11
on:
2-
# schedule in CEST (summer only) at 17:00 and 20:00 local -> 15:00 and 18:00 UTC
3-
# active Apr–Oct
42
schedule:
3+
- cron: '0 12 * * *'
54
- cron: '0 15 * * *'
65
- cron: '0 18 * * *'
6+
- cron: '0 22 * * *'
77
# manual
88
workflow_dispatch:
99

1010

1111
jobs:
12+
notify_discord_start:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: tsickert/discord-webhook@v5.3.0
16+
with:
17+
webhook-url: ${{ secrets.DEPLOY_DISCORD_WEBHOOK }}
18+
username: "Update Api 🤖"
19+
content: "Starting API update process..."
20+
1221
api:
1322
runs-on: ubuntu-latest
1423
steps:

tools/build_api_docs.mjs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ dotenv.config();
1818
// execSync(cmd);
1919

2020
const isDev = process.argv.includes("--dev");
21+
const isGithubActions = process.env.GITHUB_ACTIONS === "true";
2122
console.log("Dev mode: " + isDev);
2223

2324
async function main() {
@@ -51,6 +52,8 @@ async function main() {
5152

5253
const versions = Object.keys(content.versions).reverse();
5354

55+
let versionsChecked = 0;
56+
5457
for (let i = 0; i < versions.length; i++) {
5558
const version = versions[i];
5659
const prevVersion = versions[i + 1];
@@ -60,6 +63,12 @@ async function main() {
6063
// skip next and experimental versions
6164
if (version.includes("next") || version.includes("experimental")) continue;
6265

66+
if (isGithubActions && versionsChecked >= 10) {
67+
console.log("Github Actions mode: limiting to 10 versions checked");
68+
break;
69+
}
70+
versionsChecked++;
71+
6372
/**
6473
* @type {{name:string, version:string, dist:{tarball:string}}}
6574
*/
@@ -130,7 +139,7 @@ async function main() {
130139

131140
// copy components.json into API folder
132141
const componentsJson = join(packageDir, "components.needle.json");
133-
if(existsSync(componentsJson)) {
142+
if (existsSync(componentsJson)) {
134143
fs.copyFileSync(componentsJson, join(outputDirectoryFull, "components.needle.json"));
135144
}
136145

0 commit comments

Comments
 (0)