new tier output
All checks were successful
Unit tests / Unit tests (lts/*) (push) Successful in -1m59s
Unit tests / Unit tests (lts/hydrogen) (push) Successful in -1m59s
NPM Audit Check / Check NPM audit (push) Successful in -2m1s
Distribution check / Generated files check (push) Successful in -1m57s
Unit tests / Unit tests (latest) (push) Successful in -1m59s

This commit is contained in:
2025-11-12 14:52:04 -05:00
parent 8170ed0565
commit ccb85e16fa
6 changed files with 52 additions and 3 deletions

View File

@@ -32,7 +32,9 @@ outputs:
destination: destination:
description: destination repo description: destination repo
deps: deps:
description: which repos to enable while building description: which repos to enable while building (stable, testing, staging)
tier:
description: which tier of repos to enable (0 for system/core, etc.)
runs: runs:
using: 'node16' using: 'node16'

17
dist/index.js vendored
View File

@@ -41397,6 +41397,7 @@ async function parse(previous, current) {
move: [], move: [],
delete: [], delete: [],
deps: getDepRepo(actions.addRepo), deps: getDepRepo(actions.addRepo),
tier: getTier(actions.addRepo || actions.removeRepo),
actions, actions,
}; };
// can't delete if there's nothing to delete/no previous success // can't delete if there's nothing to delete/no previous success
@@ -41445,6 +41446,21 @@ function getDepRepo(destination) {
return 'stable'; return 'stable';
} }
} }
function getTier(destination) {
const split = (destination || '').split('-');
switch (split[0]) {
case 'extra':
case 'world':
return '1';
case 'galaxy':
return '2';
case 'multilib':
case 'lib32':
return '3';
default:
return '0';
}
}
async function tryRead(location) { async function tryRead(location) {
try { try {
const contents = isUrl(location) ? await (await distribution.get(location)).text() : await promises_namespaceObject.readFile(location, { encoding: 'utf-8' }); const contents = isUrl(location) ? await (await distribution.get(location)).text() : await promises_namespaceObject.readFile(location, { encoding: 'utf-8' });
@@ -41534,6 +41550,7 @@ async function doParse() {
core.setOutput('delete', diff.delete.length > 0); core.setOutput('delete', diff.delete.length > 0);
core.setOutput('destination', diff.actions.addRepo); core.setOutput('destination', diff.actions.addRepo);
core.setOutput('deps', diff.deps); core.setOutput('deps', diff.deps);
core.setOutput('tier', diff.tier);
} }
//# sourceMappingURL=router.js.map //# sourceMappingURL=router.js.map
;// CONCATENATED MODULE: ./lib/src/index.js ;// CONCATENATED MODULE: ./lib/src/index.js

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

View File

@@ -27,6 +27,7 @@ export interface Result {
move: PackageInfo[]; move: PackageInfo[];
delete: PackageInfo[]; delete: PackageInfo[];
deps: DependencyRepo; deps: DependencyRepo;
tier: string;
actions: Actions; actions: Actions;
} }
@@ -64,6 +65,7 @@ export async function parse(previous: string, current: string): Promise<Result>
move: [], move: [],
delete: [], delete: [],
deps: getDepRepo(actions.addRepo), deps: getDepRepo(actions.addRepo),
tier: getTier(actions.addRepo || actions.removeRepo),
actions, actions,
}; };
@@ -120,6 +122,22 @@ export function getDepRepo(destination: string): DependencyRepo {
} }
} }
export function getTier(destination: string): string {
const split = (destination || '').split('-');
switch(split[0]) {
case 'extra':
case 'world':
return '1';
case 'galaxy':
return '2';
case 'multilib':
case 'lib32':
return '3';
default:
return '0';
}
}
export async function tryRead(location: string): Promise<PkgBase | null> { export async function tryRead(location: string): Promise<PkgBase | null> {
try { try {
const contents = isUrl(location) ? await (await ky.get(location)).text() : await fsp.readFile(location, { encoding: 'utf-8' }); const contents = isUrl(location) ? await (await ky.get(location)).text() : await fsp.readFile(location, { encoding: 'utf-8' });

View File

@@ -83,4 +83,5 @@ async function doParse() {
core.setOutput('delete', diff.delete.length > 0); core.setOutput('delete', diff.delete.length > 0);
core.setOutput('destination', diff.actions.addRepo); core.setOutput('destination', diff.actions.addRepo);
core.setOutput('deps', diff.deps); core.setOutput('deps', diff.deps);
core.setOutput('tier', diff.tier);
} }

View File

@@ -1,6 +1,6 @@
import path from 'path'; import path from 'path';
import { describe, expect, it } from 'vitest'; import { describe, expect, it } from 'vitest';
import { parse, getDepRepo, type Result } from '../src/pkgbase.js'; import { parse, getDepRepo, getTier, type Result } from '../src/pkgbase.js';
describe('pkgbase parser', () => { describe('pkgbase parser', () => {
it('can detect an add operation', async () => { it('can detect an add operation', async () => {
@@ -9,6 +9,7 @@ describe('pkgbase parser', () => {
move: [], move: [],
delete: [], delete: [],
deps: 'staging', deps: 'staging',
tier: '0',
actions: { actions: {
addRepo: 'system-goblins', addRepo: 'system-goblins',
removeRepo: null, removeRepo: null,
@@ -29,6 +30,7 @@ describe('pkgbase parser', () => {
move: [], move: [],
delete: [], delete: [],
deps: 'stable', deps: 'stable',
tier: '1',
actions: { actions: {
addRepo: 'world', addRepo: 'world',
removeRepo: null, removeRepo: null,
@@ -68,6 +70,7 @@ describe('pkgbase parser', () => {
} }
], ],
deps: 'stable', deps: 'stable',
tier: '1',
actions: { actions: {
addRepo: 'world', addRepo: 'world',
removeRepo: null, removeRepo: null,
@@ -100,6 +103,7 @@ describe('pkgbase parser', () => {
"version": "1:7.9.1-1", "version": "1:7.9.1-1",
}], }],
deps: 'stable', deps: 'stable',
tier: '1',
actions: { actions: {
addRepo: 'world', addRepo: 'world',
removeRepo: 'world-gremlins', removeRepo: 'world-gremlins',
@@ -152,6 +156,7 @@ describe('pkgbase parser', () => {
} }
], ],
deps: 'stable', deps: 'stable',
tier: '1',
actions: { actions: {
addRepo: 'world', addRepo: 'world',
removeRepo: 'world-gremlins', removeRepo: 'world-gremlins',
@@ -191,6 +196,7 @@ describe('pkgbase parser', () => {
} }
], ],
deps: 'stable', deps: 'stable',
tier: '1',
actions: { actions: {
addRepo: null, addRepo: null,
removeRepo: 'world', removeRepo: 'world',
@@ -209,5 +215,10 @@ describe('pkgbase parser', () => {
expect(getDepRepo('core')).to.be.equal('stable'); expect(getDepRepo('core')).to.be.equal('stable');
expect(getDepRepo('core-testing')).to.be.equal('testing'); expect(getDepRepo('core-testing')).to.be.equal('testing');
expect(getDepRepo('extra-staging')).to.be.equal('staging'); expect(getDepRepo('extra-staging')).to.be.equal('staging');
expect(getTier('core-testing')).to.be.equal('0');
expect(getTier('extra')).to.be.equal('1');
expect(getTier('galaxy-goblins')).to.be.equal('2');
expect(getTier('multilib')).to.be.equal('3');
expect(getTier('lib32')).to.be.equal('3');
}); });
}); });