Skip to content

Commit 3be1d42

Browse files
authored
Update check-plugin-links.yml
Test 11
1 parent de517df commit 3be1d42

File tree

1 file changed

+20
-15
lines changed

1 file changed

+20
-15
lines changed

.github/workflows/check-plugin-links.yml

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,12 @@ jobs:
3333

3434
- name: Validate Download Links
3535
run: |
36-
node <<EOF
36+
echo "Starting validation script"
37+
node ./validate-links.js
38+
39+
- name: Add Validation Script
40+
run: |
41+
cat <<EOF > validate-links.js
3742
const axios = require('axios');
3843
const fs = require('fs');
3944
@@ -51,7 +56,7 @@ jobs:
5156
5257
try {
5358
const repoName = repoUrl.replace('https://github.com/', '');
54-
const apiUrl = `https://api.github.com/repos/${repoName}/releases/latest`;
59+
const apiUrl = \`https://api.github.com/repos/\${repoName}/releases/latest\`;
5560
5661
await sleep(2000); // Throttle requests with 2 seconds delay
5762
@@ -65,28 +70,28 @@ jobs:
6570
const latestDownloadUrl = response.data.assets[0]?.browser_download_url || null;
6671
6772
if (!latestDownloadUrl) {
68-
console.warn(\`⚠️ ${plugin.name}: No downloadable asset found in the latest release.\`);
69-
console.log(\`::warning file=badges.json,line=1::${plugin.name} has no downloadable asset in its latest release.\`);
73+
console.warn(\`⚠️ \${plugin.name}: No downloadable asset found in the latest release.\`);
74+
console.log(\`::warning file=badges.json,line=1::\${plugin.name} has no downloadable asset in its latest release.\`);
7075
} else if (releaseUrl === latestDownloadUrl) {
71-
console.log(\`✅ ${plugin.name}: Download link is up-to-date.\`);
76+
console.log(\`✅ \${plugin.name}: Download link is up-to-date.\`);
7277
} else {
73-
console.error(\`❌ ${plugin.name}: Download link is outdated.\`);
74-
console.error(\` Expected: ${latestDownloadUrl}\`);
75-
console.error(\` Found: ${releaseUrl}\`);
76-
console.log(\`::error file=badges.json,line=1::${plugin.name} has an outdated download link.\`);
78+
console.error(\`❌ \${plugin.name}: Download link is outdated.\`);
79+
console.error(\` Expected: \${latestDownloadUrl}\`);
80+
console.error(\` Found: \${releaseUrl}\`);
81+
console.log(\`::error file=badges.json,line=1::\${plugin.name} has an outdated download link.\`);
7782
hasErrors = true;
7883
}
7984
} catch (error) {
8085
if (error.response?.status === 404) {
81-
console.warn(\`⚠️ ${plugin.name}: No releases found (404).\`);
82-
console.log(\`::warning file=badges.json,line=1::${plugin.name} has no releases.\`);
86+
console.warn(\`⚠️ \${plugin.name}: No releases found (404).\`);
87+
console.log(\`::warning file=badges.json,line=1::\${plugin.name} has no releases.\`);
8388
} else if (error.response?.status === 403) {
84-
console.error(\`⚠️ ${plugin.name}: Rate limited or access denied (403).\`);
85-
console.log(\`::error file=badges.json,line=1::${plugin.name} encountered an access issue.\`);
89+
console.error(\`⚠️ \${plugin.name}: Rate limited or access denied (403).\`);
90+
console.log(\`::error file=badges.json,line=1::\${plugin.name} encountered an access issue.\`);
8691
hasErrors = true;
8792
} else {
88-
console.error(\`⚠️ Error checking ${plugin.name}: ${error.message}\`);
89-
console.log(\`::error file=badges.json,line=1::${plugin.name} encountered an error: ${error.message}\`);
93+
console.error(\`⚠️ Error checking \${plugin.name}: \${error.message}\`);
94+
console.log(\`::error file=badges.json,line=1::\${plugin.name} encountered an error: \${error.message}\`);
9095
hasErrors = true;
9196
}
9297
}

0 commit comments

Comments
 (0)