File tree Expand file tree Collapse file tree 4 files changed +13
-6
lines changed Expand file tree Collapse file tree 4 files changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,9 @@ inputs:
17
17
allow-external-github-orgs :
18
18
required : false
19
19
description : ' Allow installing from external GitHub organizations'
20
+ github-orgs-allow-list :
21
+ required : false
22
+ description : ' Comma separated list of orgs that are allowed even if external orgs are not allowed'
20
23
artifactory-url :
21
24
required : false
22
25
description : ' Artifactory URL to use for downloading Foreman tools'
Original file line number Diff line number Diff line change @@ -18,7 +18,8 @@ const MANIFEST = "foreman.toml";
18
18
19
19
function checkSameOrgToolSpecs (
20
20
manifestContent : foremanConfig ,
21
- org : string
21
+ org : string ,
22
+ allowList : string [ ]
22
23
) : boolean {
23
24
const tools = manifestContent . tools ;
24
25
if ( tools == null ) {
@@ -44,13 +45,13 @@ function checkSameOrgToolSpecs(
44
45
) ;
45
46
}
46
47
if ( tool_org . toLowerCase ( ) != org ) {
47
- return false ;
48
+ return allowList . includes ( tool_org . toLowerCase ( ) )
48
49
}
49
50
}
50
51
return true ;
51
52
}
52
53
53
- async function checkSameOrgInConfig ( org : string ) : Promise < void > {
54
+ async function checkSameOrgInConfig ( org : string , allowList : string [ ] ) : Promise < void > {
54
55
const manifestPath = await findUp ( MANIFEST ) ;
55
56
if ( manifestPath == undefined ) {
56
57
throw new Error ( "setup-foreman could not find Foreman config file" ) ;
@@ -63,7 +64,7 @@ async function checkSameOrgInConfig(org: string): Promise<void> {
63
64
) ;
64
65
}
65
66
const manifestContent = parse ( data ) ;
66
- const sameGithubOrgSource = checkSameOrgToolSpecs ( manifestContent , org ) ;
67
+ const sameGithubOrgSource = checkSameOrgToolSpecs ( manifestContent , org , allowList ) ;
67
68
if ( ! sameGithubOrgSource ) {
68
69
throw new Error (
69
70
`All GitHub orgs in Foreman config must match the org setup-foreman runs in: ${ org } . To disable this check, set the \"allow-external-github-orgs\" option to true.`
Original file line number Diff line number Diff line change @@ -19,6 +19,9 @@ async function run(): Promise<void> {
19
19
const allowExternalGithubOrgs : string = getInput (
20
20
"allow-external-github-orgs"
21
21
) . toLowerCase ( ) ;
22
+ const githubOrgsAllowList : string [ ] = getInput (
23
+ "github-orgs-allow-list"
24
+ ) . split ( "," ) . map ( ( org : string ) => org . trim ( ) . toLowerCase ( ) ) . filter ( ( org ) => org !== "" ) ;
22
25
const artifactoryUrl = getInput ( "artifactory-url" ) ;
23
26
const artifactoryToken = getInput ( "artifactory-token" ) ;
24
27
@@ -85,7 +88,7 @@ async function run(): Promise<void> {
85
88
`Could not find repository owner setup-foreman is running in`
86
89
) ;
87
90
}
88
- configFile . checkSameOrgInConfig ( owner . toLowerCase ( ) ) ;
91
+ configFile . checkSameOrgInConfig ( owner . toLowerCase ( ) , githubOrgsAllowList ) ;
89
92
}
90
93
91
94
await foreman . installTools ( ) ;
Original file line number Diff line number Diff line change 1
1
{
2
2
"compilerOptions" : {
3
- "target" : " es6 " ,
3
+ "target" : " es2016 " ,
4
4
"module" : " commonjs" ,
5
5
"outDir" : " ./lib" ,
6
6
"rootDir" : " ./src" ,
You can’t perform that action at this time.
0 commit comments