File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ name : ' Format Tag'
2+ description : ' Formats a git tag to remove potentially prefixes'
3+ inputs :
4+ tag :
5+ description : ' The input tag'
6+ required : true
7+ outputs :
8+ subpackage :
9+ description : ' Whether this tag is a subpackage tag'
10+ package :
11+ description : ' The package string that was extracted from this tag'
12+ semver :
13+ description : ' The semver string that was extracted from this tag'
14+ runs :
15+ using : node20
16+ main : ../../dist/formatTag/index.js
Original file line number Diff line number Diff line change 1+ export function formatTag ( tag : string ) {
2+ const parsed = / (?: ^ @ .* \/ (?< package > .* ) @ v ? ) ? (?< semver > \d + .\d + .\d + ) - ? .* / . exec ( tag ) ;
3+ const parsedPackage = / (?< package > .* ) @ v ? - ? .* / . exec ( tag ) ;
4+
5+ if ( parsed ?. groups ) {
6+ const isSubPackage = typeof parsed . groups . package === 'string' ;
7+ const pkg = isSubPackage ? parsed . groups . package : parsedPackage ?. groups ?. package ?? 'discord.js' ;
8+ const semver = parsed . groups . semver ;
9+
10+ return {
11+ isSubpackage : isSubPackage ,
12+ package : pkg ,
13+ semver,
14+ } ;
15+ }
16+
17+ return null ;
18+ }
Original file line number Diff line number Diff line change 1+ import { getInput , setOutput } from '@actions/core' ;
2+ import { formatTag } from './formatTag.js' ;
3+
4+ const tag = getInput ( 'tag' , { required : true } ) ;
5+ const parsed = formatTag ( tag ) ;
6+
7+ if ( parsed ) {
8+ setOutput ( 'subpackage' , parsed . isSubpackage ) ;
9+ setOutput ( 'package' , parsed . package ) ;
10+ setOutput ( 'semver' , parsed . semver ) ;
11+ }
You can’t perform that action at this time.
0 commit comments