mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2026-09-09 18:03:21 +00:00
[ci:force] - Fixed sonar comments and added correct version to sha pinned action
This commit is contained in:
@@ -34,7 +34,7 @@ runs:
|
||||
shell: bash
|
||||
run: echo "nx-github-actions" | sudo tee /etc/machine-id > /dev/null
|
||||
- name: Setup pnpm
|
||||
uses: pnpm/action-setup@b906affcce14559ad1aafd4ab0e942779e9f58b1 # v4
|
||||
uses: pnpm/action-setup@b906affcce14559ad1aafd4ab0e942779e9f58b1 # v4.3.0
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
|
||||
with:
|
||||
|
||||
@@ -54,8 +54,9 @@ function parsePackageFromDiffLine(line) {
|
||||
}
|
||||
|
||||
const isScoped = fullPath.startsWith('@');
|
||||
const lastAtIndex = fullPath.lastIndexOf('@');
|
||||
const packageName = isScoped
|
||||
? fullPath.replace(/@[^/]+$/, '')
|
||||
? fullPath.substring(0, lastAtIndex)
|
||||
: fullPath.split('@')[0];
|
||||
|
||||
return { name: packageName, version: versionMatch[1] };
|
||||
@@ -65,18 +66,39 @@ function parsePackageFromDiffLine(line) {
|
||||
// LOCKFILE READING
|
||||
// ============================================================================
|
||||
|
||||
function extractPackagePathFromLine(line) {
|
||||
const trimmed = line.trim();
|
||||
|
||||
if (!trimmed.startsWith("'/") && !trimmed.startsWith('/')) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const startIndex = trimmed.indexOf('/') + 1;
|
||||
const endQuoteIndex = trimmed.indexOf("'", startIndex);
|
||||
const endParenIndex = trimmed.indexOf('(', startIndex);
|
||||
|
||||
let endIndex = trimmed.length;
|
||||
if (endQuoteIndex > 0) endIndex = Math.min(endIndex, endQuoteIndex);
|
||||
if (endParenIndex > 0) endIndex = Math.min(endIndex, endParenIndex);
|
||||
|
||||
return trimmed.substring(startIndex, endIndex);
|
||||
}
|
||||
|
||||
export function readAllPackagesFromLockfile(lockfilePath) {
|
||||
try {
|
||||
const lockfileContent = readFileSync(lockfilePath, 'utf-8');
|
||||
const packages = [];
|
||||
const packagePathRegex = /^\s+'?\/([^'(]+)'/gm;
|
||||
const lines = lockfileContent.split('\n');
|
||||
|
||||
let match;
|
||||
while ((match = packagePathRegex.exec(lockfileContent)) !== null) {
|
||||
const parsedPackage = parsePackagePathEntry(match[1]);
|
||||
for (const line of lines) {
|
||||
const packagePath = extractPackagePathFromLine(line);
|
||||
|
||||
if (parsedPackage) {
|
||||
packages.push(parsedPackage);
|
||||
if (packagePath) {
|
||||
const parsedPackage = parsePackagePathEntry(packagePath);
|
||||
|
||||
if (parsedPackage) {
|
||||
packages.push(parsedPackage);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,7 +110,7 @@ export function readAllPackagesFromLockfile(lockfilePath) {
|
||||
|
||||
export function readChangedPackagesFromGitDiff() {
|
||||
try {
|
||||
const diffOutput = execSync('git diff --cached pnpm-lock.yaml', { encoding: 'utf-8' });
|
||||
const diffOutput = execSync('/usr/bin/git diff --cached pnpm-lock.yaml', { encoding: 'utf-8' });
|
||||
const changedPackages = [];
|
||||
const diffLines = diffOutput.split('\n');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user