[ACS-5186] Stop upstream workflow from failing when there are no new versions (#3206)

This commit is contained in:
MichalKinas 2023-05-19 12:56:08 +02:00 committed by GitHub
parent 5d4a999ca1
commit 19e31adbb9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -30,26 +30,26 @@ jobs:
github-token: ${{ secrets.BOT_GITHUB_TOKEN }} github-token: ${{ secrets.BOT_GITHUB_TOKEN }}
script: | script: |
const getLatestVersionOf = require('./scripts/gh/update/latest-version-of.js'); const getLatestVersionOf = require('./scripts/gh/update/latest-version-of.js');
const { hasNewVersion: hasNewADFVersion , remoteVersion: latestADFVersion } = await getLatestVersionOf({github, dependencyName: 'adf-core'}) const { hasNewVersion: hasNewADFVersion , remoteVersion: latestADFVersion } = await getLatestVersionOf({github, dependencyName: 'adf-core'});
console.log('hasNewADFVersion', hasNewADFVersion) console.log('hasNewADFVersion', hasNewADFVersion);
console.log('latestADFVersion', latestADFVersion.name) console.log('latestADFVersion', latestADFVersion?.name);
const { hasNewVersion: hasNewJSVersion, remoteVersion: latestJSVersion } = await getLatestVersionOf({github, dependencyName: 'js-api'}); const { hasNewVersion: hasNewJSVersion, remoteVersion: latestJSVersion } = await getLatestVersionOf({github, dependencyName: 'js-api'});
console.log('hasNewJSVersion', hasNewJSVersion) console.log('hasNewJSVersion', hasNewJSVersion);
console.log('latestJSVersion', latestJSVersion.name) console.log('latestJSVersion', latestJSVersion?.name);
if (hasNewADFVersion === 'true' || hasNewJSVersion === 'true' ) { if (hasNewADFVersion === 'true' || hasNewJSVersion === 'true' ) {
core.setOutput('hasNewVersion', 'true'); core.setOutput('hasNewVersion', 'true');
if (hasNewADFVersion === 'true') { if (hasNewADFVersion === 'true') {
core.setOutput('hasNewADFVersion', 'true'); core.setOutput('hasNewADFVersion', 'true');
core.setOutput('latestADFVersion', latestADFVersion.name); core.setOutput('latestADFVersion', latestADFVersion?.name);
} }
if (hasNewJSVersion === 'true') { if (hasNewJSVersion === 'true') {
core.setOutput('hasNewJSVersion', 'true'); core.setOutput('hasNewJSVersion', 'true');
core.setOutput('latestJSVersion', latestJSVersion.name); core.setOutput('latestJSVersion', latestJSVersion?.name);
} }
} else { } else {
core.setOutput('hasNewVersion', 'false'); core.setOutput('hasNewVersion', 'false');
console.log('No new version available, skipping upstream!') console.log('No new version available, skipping upstream!');
} }
- name: Check value after - name: Check value after
run: | run: |
@ -159,8 +159,8 @@ jobs:
with: with:
github-token: ${{ secrets.BOT_GITHUB_TOKEN }} github-token: ${{ secrets.BOT_GITHUB_TOKEN }}
script: | script: |
const { PACKAGE_VERSION_ADF } = process.env const { PACKAGE_VERSION_ADF } = process.env;
const { PACKAGE_VERSION_JS } = process.env const { PACKAGE_VERSION_JS } = process.env;
const BRANCH_TO_CREATE = 'upstream-dependencies'; const BRANCH_TO_CREATE = 'upstream-dependencies';
let title = `GH Auto: Upstream dependencies ADF:${PACKAGE_VERSION_ADF} JS-API:${PACKAGE_VERSION_JS} using Tag:${PACKAGE_VERSION_ADF}`; let title = `GH Auto: Upstream dependencies ADF:${PACKAGE_VERSION_ADF} JS-API:${PACKAGE_VERSION_JS} using Tag:${PACKAGE_VERSION_ADF}`;
if (PACKAGE_VERSION_ADF === 'next' || PACKAGE_VERSION_ADF === 'latest') { if (PACKAGE_VERSION_ADF === 'next' || PACKAGE_VERSION_ADF === 'latest') {