mirror of
https://github.com/n8n-io/n8n.git
synced 2026-05-27 06:45:26 +02:00
ci: Fail release build on node popularity data fetch error (#20466)
This commit is contained in:
parent
3e1a44bb29
commit
49064fc6da
4
.github/workflows/release-publish.yml
vendored
4
.github/workflows/release-publish.yml
vendored
|
|
@ -20,6 +20,8 @@ jobs:
|
|||
|
||||
- name: Setup and Build ARM64
|
||||
uses: ./.github/actions/setup-nodejs-blacksmith
|
||||
env:
|
||||
N8N_FAIL_ON_POPULARITY_FETCH_ERROR: true
|
||||
|
||||
publish-to-npm:
|
||||
name: Publish to NPM
|
||||
|
|
@ -40,6 +42,8 @@ jobs:
|
|||
|
||||
- name: Setup and Build
|
||||
uses: ./.github/actions/setup-nodejs-github
|
||||
env:
|
||||
N8N_FAIL_ON_POPULARITY_FETCH_ERROR: true
|
||||
|
||||
- name: Dry-run publishing
|
||||
run: |
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|||
const POPULARITY_ENDPOINT =
|
||||
process.env.NODE_POPULARITY_ENDPOINT ||
|
||||
'https://internal.users.n8n.cloud/webhook/nodes-popularity-scores';
|
||||
const FAIL_ON_ERROR = process.env.N8N_FAIL_ON_POPULARITY_FETCH_ERROR === 'true';
|
||||
const BUILD_DIR = path.join(__dirname, '..', '.build');
|
||||
const OUTPUT_FILE = path.join(BUILD_DIR, 'node-popularity.json');
|
||||
|
||||
|
|
@ -76,13 +77,24 @@ async function main() {
|
|||
// Save the fresh data
|
||||
await savePopularityData(freshData);
|
||||
} else {
|
||||
// Fetching failed, check if we have existing data
|
||||
// Fetching failed
|
||||
if (FAIL_ON_ERROR) {
|
||||
console.error('N8N_FAIL_ON_POPULARITY_FETCH_ERROR is set - failing build');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
// Check if we have existing data
|
||||
console.log('API unavailable, checking for existing cached data');
|
||||
await fallbackToExistingData();
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Error in fetch-node-popularity script:', error);
|
||||
|
||||
if (FAIL_ON_ERROR) {
|
||||
console.error('N8N_FAIL_ON_POPULARITY_FETCH_ERROR is set - failing build');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
await fallbackToExistingData();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,8 @@
|
|||
"dependsOn": ["popularity-cache-marker"],
|
||||
"cache": true,
|
||||
"outputs": [".build/node-popularity.json"],
|
||||
"inputs": ["scripts/fetch-node-popularity.mjs", ".build/cache-marker"]
|
||||
"inputs": ["scripts/fetch-node-popularity.mjs", ".build/cache-marker"],
|
||||
"env": ["N8N_FAIL_ON_POPULARITY_FETCH_ERROR"]
|
||||
},
|
||||
"build": {
|
||||
"dependsOn": ["^build", "fetch-popularity"],
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user