5 Commits
v1.0.1 ... v1

Author SHA1 Message Date
ccb85e16fa 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
2025-11-12 14:52:04 -05:00
8170ed0565 Add logging
All checks were successful
Distribution check / Generated files check (push) Successful in -1m58s
NPM Audit Check / Check NPM audit (push) Successful in -2m9s
Unit tests / Unit tests (latest) (push) Successful in -1m59s
Unit tests / Unit tests (lts/*) (push) Successful in -1m59s
Unit tests / Unit tests (lts/hydrogen) (push) Successful in -1m58s
2025-11-12 12:25:30 -05:00
112afbe142 update dist
All checks were successful
Unit tests / Unit tests (latest) (push) Successful in -1m49s
Unit tests / Unit tests (lts/*) (push) Successful in -1m59s
Unit tests / Unit tests (lts/hydrogen) (push) Successful in -1m59s
Distribution check / Generated files check (push) Successful in -1m48s
NPM Audit Check / Check NPM audit (push) Successful in -2m9s
2025-11-12 11:55:13 -05:00
fc87114c36 use repo name
Some checks failed
NPM Audit Check / Check NPM audit (push) Successful in -2m9s
Unit tests / Unit tests (latest) (push) Successful in -1m59s
Unit tests / Unit tests (lts/*) (push) Successful in -2m0s
Unit tests / Unit tests (lts/hydrogen) (push) Successful in -1m59s
Distribution check / Generated files check (push) Failing after -1m57s
2025-11-11 01:10:56 -05:00
8f96ff74ec link package to repo
All checks were successful
Distribution check / Generated files check (push) Successful in -1m58s
NPM Audit Check / Check NPM audit (push) Successful in -2m10s
Unit tests / Unit tests (latest) (push) Successful in -2m0s
Unit tests / Unit tests (lts/*) (push) Successful in -2m0s
Unit tests / Unit tests (lts/hydrogen) (push) Successful in -1m59s
2025-11-11 01:04:50 -05:00
8 changed files with 63 additions and 6 deletions

View File

@@ -32,7 +32,9 @@ outputs:
destination:
description: destination repo
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:
using: 'node16'

21
dist/index.js vendored
View File

@@ -41397,6 +41397,7 @@ async function parse(previous, current) {
move: [],
delete: [],
deps: getDepRepo(actions.addRepo),
tier: getTier(actions.addRepo || actions.removeRepo),
actions,
};
// can't delete if there's nothing to delete/no previous success
@@ -41445,6 +41446,21 @@ function getDepRepo(destination) {
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) {
try {
const contents = isUrl(location) ? await (await distribution.get(location)).text() : await promises_namespaceObject.readFile(location, { encoding: 'utf-8' });
@@ -41486,6 +41502,7 @@ async function main() {
if (mode === 'move') {
for (const pkg of parsedData.move) {
const filename = getFilename(pkg);
console.log(`moving ${filename} from ${parsedData.actions.removeRepo} to ${parsedData.actions.addRepo} ...`);
const files = await distribution.get(`${github.context.serverUrl}/api/v1/packages/${github.context.repo.owner}/arch/${pkg.package}/${pkg.version}/files`, { headers }).json();
const match = files.filter(f => f.name === filename);
if (match.length !== 1) {
@@ -41497,11 +41514,13 @@ async function main() {
body,
headers
});
await distribution.post(`${github.context.serverUrl}/api/v1/packages/${github.context.repo.owner}/arch/${pkg.package}/-/link/${github.context.repo.repo}`, { headers });
}
await deletePackages(parsedData.move, headers);
return;
}
else if (mode === 'delete') {
console.log(`deleting ${parsedData.delete.join(', ') || 'no packages'} ...`);
await deletePackages(parsedData.delete, headers);
return;
}
@@ -41524,12 +41543,14 @@ async function doParse() {
const previous = core.getInput('previous', { required: true });
const current = getCurrent();
const diff = await parse(previous, current);
console.log(diff);
core.setOutput('parsed-data', JSON.stringify(diff));
core.setOutput('build', diff.build);
core.setOutput('move', diff.move.length > 0);
core.setOutput('delete', diff.delete.length > 0);
core.setOutput('destination', diff.actions.addRepo);
core.setOutput('deps', diff.deps);
core.setOutput('tier', diff.tier);
}
//# sourceMappingURL=router.js.map
;// CONCATENATED MODULE: ./lib/src/index.js

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

4
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{
"name": "pkgbase-yaml-parser",
"version": "1.0.1",
"version": "1.0.3",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "pkgbase-yaml-parser",
"version": "1.0.1",
"version": "1.0.3",
"license": "MIT",
"dependencies": {
"@actions/core": "^1.11.1",

View File

@@ -1,6 +1,6 @@
{
"name": "pkgbase-yaml-parser",
"version": "1.0.1",
"version": "1.0.3",
"description": "compare Artix `pkgbase.yaml` files",
"keywords": [
"artix",

View File

@@ -27,6 +27,7 @@ export interface Result {
move: PackageInfo[];
delete: PackageInfo[];
deps: DependencyRepo;
tier: string;
actions: Actions;
}
@@ -64,6 +65,7 @@ export async function parse(previous: string, current: string): Promise<Result>
move: [],
delete: [],
deps: getDepRepo(actions.addRepo),
tier: getTier(actions.addRepo || actions.removeRepo),
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> {
try {
const contents = isUrl(location) ? await (await ky.get(location)).text() : await fsp.readFile(location, { encoding: 'utf-8' });

View File

@@ -31,6 +31,7 @@ export async function main() {
if (mode === 'move') {
for (const pkg of parsedData.move) {
const filename = getFilename(pkg);
console.log(`moving ${filename} from ${parsedData.actions.removeRepo} to ${parsedData.actions.addRepo} ...`);
const files = await ky.get(`${context.serverUrl}/api/v1/packages/${context.repo.owner}/arch/${pkg.package}/${pkg.version}/files`, { headers }).json<PackageFile[]>();
const match = files.filter(f => f.name === filename);
if (match.length !== 1) {
@@ -42,11 +43,13 @@ export async function main() {
body,
headers
});
await ky.post(`${context.serverUrl}/api/v1/packages/${context.repo.owner}/arch/${pkg.package}/-/link/${context.repo.repo}`, { headers });
}
await deletePackages(parsedData.move, headers);
return;
}
else if (mode === 'delete') {
console.log(`deleting ${parsedData.delete.join(', ') || 'no packages'} ...`);
await deletePackages(parsedData.delete, headers);
return;
}
@@ -73,10 +76,12 @@ async function doParse() {
const previous = core.getInput('previous', { required: true });
const current = getCurrent();
const diff = await parse(previous, current);
console.log(diff);
core.setOutput('parsed-data', JSON.stringify(diff));
core.setOutput('build', diff.build);
core.setOutput('move', diff.move.length > 0);
core.setOutput('delete', diff.delete.length > 0);
core.setOutput('destination', diff.actions.addRepo);
core.setOutput('deps', diff.deps);
core.setOutput('tier', diff.tier);
}

View File

@@ -1,6 +1,6 @@
import path from 'path';
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', () => {
it('can detect an add operation', async () => {
@@ -9,6 +9,7 @@ describe('pkgbase parser', () => {
move: [],
delete: [],
deps: 'staging',
tier: '0',
actions: {
addRepo: 'system-goblins',
removeRepo: null,
@@ -29,6 +30,7 @@ describe('pkgbase parser', () => {
move: [],
delete: [],
deps: 'stable',
tier: '1',
actions: {
addRepo: 'world',
removeRepo: null,
@@ -68,6 +70,7 @@ describe('pkgbase parser', () => {
}
],
deps: 'stable',
tier: '1',
actions: {
addRepo: 'world',
removeRepo: null,
@@ -100,6 +103,7 @@ describe('pkgbase parser', () => {
"version": "1:7.9.1-1",
}],
deps: 'stable',
tier: '1',
actions: {
addRepo: 'world',
removeRepo: 'world-gremlins',
@@ -152,6 +156,7 @@ describe('pkgbase parser', () => {
}
],
deps: 'stable',
tier: '1',
actions: {
addRepo: 'world',
removeRepo: 'world-gremlins',
@@ -191,6 +196,7 @@ describe('pkgbase parser', () => {
}
],
deps: 'stable',
tier: '1',
actions: {
addRepo: null,
removeRepo: 'world',
@@ -209,5 +215,10 @@ describe('pkgbase parser', () => {
expect(getDepRepo('core')).to.be.equal('stable');
expect(getDepRepo('core-testing')).to.be.equal('testing');
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');
});
});