fix: normalize refs-tag inputs (#755)

Signed-off-by: Rui Chen <rui@chenrui.dev>
This commit is contained in:
Rui Chen
2026-03-15 00:05:22 -04:00
committed by GitHub
parent 21ae1a1eb2
commit 45211baa90
7 changed files with 103 additions and 29 deletions

View File

@@ -2,6 +2,7 @@ import {
alignAssetName,
isTag,
normalizeGlobPattern,
normalizeTagName,
parseConfig,
parseInputFiles,
paths,
@@ -469,6 +470,10 @@ describe('util', () => {
},
);
});
it('normalizes refs/tags-prefixed input_tag_name values', () => {
expect(parseConfig({ INPUT_TAG_NAME: 'refs/tags/v1.2.3' }).input_tag_name).toBe('v1.2.3');
});
});
describe('isTag', () => {
it('returns true for tags', async () => {
@@ -479,6 +484,16 @@ describe('util', () => {
});
});
describe('normalizeTagName', () => {
it('strips refs/tags/ from explicit tag names', () => {
assert.equal(normalizeTagName('refs/tags/v1.2.3'), 'v1.2.3');
});
it('leaves plain tag names unchanged', () => {
assert.equal(normalizeTagName('v1.2.3'), 'v1.2.3');
});
});
describe('paths', () => {
it('resolves files given a set of paths', async () => {
assert.deepStrictEqual(paths(['tests/data/**/*', 'tests/data/does/not/exist/*']), [