File tree Expand file tree Collapse file tree 3 files changed +14
-13
lines changed
Expand file tree Collapse file tree 3 files changed +14
-13
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change 11import type { Config } from "../types/config" ;
2- import { randomizer } from "./randomizer" ;
32import type { GitHub } from "@actions/github/lib/utils" ;
43import type { RestEndpointMethodTypes } from "@octokit/plugin-rest-endpoint-methods/dist-types/generated/parameters-and-response-types" ;
54import { exec } from "./processes" ;
5+ import { randomString } from "./strings" ;
66
77export class Repository {
88 private _config : Config ;
@@ -179,7 +179,7 @@ export class Repository {
179179 if ( this . _currentBranch === "" ) {
180180 this . _currentBranch = this . _config . repository . commit . branch . replace (
181181 "{random}" ,
182- randomizer ( ) ,
182+ randomString ( ) ,
183183 ) ;
184184 }
185185
Original file line number Diff line number Diff line change @@ -23,3 +23,15 @@ export const encodeUri = (value: string | undefined): string => {
2323
2424 return encodeURIComponent ( value ) ;
2525} ;
26+
27+ export const randomString = ( length : number = 8 ) => {
28+ const chars = "abcdefghijklmnopqrstuvwxyz" ;
29+
30+ let result : string = "" ;
31+
32+ for ( let i : number = 0 ; i < length ; i ++ ) {
33+ result += chars . charAt ( Math . floor ( Math . random ( ) * chars . length ) ) ;
34+ }
35+
36+ return result ;
37+ } ;
You can’t perform that action at this time.
0 commit comments