[AAE-13775] Upstream js - fix issue (#8484)

* fix issue

* fix issue

* put back \'

* fix reg for release

* add missing script

* remove logs
This commit is contained in:
Maurizio Vitale
2023-04-17 16:22:41 +01:00
committed by GitHub
parent 79a196a381
commit 0489992921
3 changed files with 30 additions and 7 deletions

View File

@@ -0,0 +1,21 @@
module.exports = async ({github, context, version}) => {
const BRANCH_TO_CREATE = 'upstream-dependencies';
const { data: prs } = await github.rest.pulls.list({
owner: context.repo.owner,
repo: context.repo.repo,
state: 'open',
head: `${context.repo.owner}:${BRANCH_TO_CREATE}`,
base: 'develop'
});
if (prs?.length > 0) {
const title = prs[0].title;
const result = title.match(version);
return result?.length > 0 ? true : false;
}
return false;
}

View File

@@ -16,18 +16,19 @@ module.exports = async ({github, context, dependencyName, tagVersion = 'alpha' }
org: organization
});
let latestPkgToUpdate = null;
if (tagVersion === 'alpha') {
let latestPkgToUpdate = undefined;
if (tagVersion !== 'release') {
console.log('alpha: taking most recent')
const filteredAlphaPkgs = availablePakages.filter( (item) => item.name.match('^[0-9]*.[0-9]*.[0-9]*.A.[0-9].[0-9]*$') )
const filteredAlphaPkgs = availablePakages.filter( (item) => item.name.match('^[0-9]*.[0-9]*.[0-9]*.-[0-9]*$'));
latestPkgToUpdate = filteredAlphaPkgs[0];
} else {
console.log('release: taking most recent')
const filteredReleasePkgs = availablePakages.filter( (item) => item.name.match('^[0-9]*.[0-9]*.[0-9]*.A.[0-9]*$') || item.name.match('^[0-9]*.[0-9]*.[0-9]*$') )
const filteredReleasePkgs = availablePakages.filter( (item) => item.name.match('^[0-9]*.[0-9]*.[0-9]*$'));
latestPkgToUpdate = filteredReleasePkgs[0];
}
if (latestPkgToUpdate === null) {
if (latestPkgToUpdate === undefined) {
console.log(`Something went wrong. Not able to find any version.`);
return { hasVersionNew: 'false' };
} else {