11import * as fs from 'fs' ;
2+ import * as path from 'path' ;
23import * as core from '@actions/core' ;
34import * as actionsToolkit from '@docker/actions-toolkit' ;
45import { Inputs as BuildxInputs } from '@docker/actions-toolkit/lib/buildx/inputs' ;
@@ -7,6 +8,7 @@ import {Docker} from '@docker/actions-toolkit/lib/docker/docker';
78import { Exec } from '@docker/actions-toolkit/lib/exec' ;
89import { GitHub } from '@docker/actions-toolkit/lib/github' ;
910import { Toolkit } from '@docker/actions-toolkit/lib/toolkit' ;
11+ import { ConfigFile } from '@docker/actions-toolkit/lib/types/docker' ;
1012
1113import * as context from './context' ;
1214import * as stateHelper from './state-helper' ;
@@ -34,6 +36,31 @@ actionsToolkit.run(
3436 }
3537 } ) ;
3638
39+ await core . group ( `Proxy configuration` , async ( ) => {
40+ let dockerConfig : ConfigFile | undefined ;
41+ let dockerConfigMalformed = false ;
42+ try {
43+ dockerConfig = await Docker . configFile ( ) ;
44+ } catch ( e ) {
45+ dockerConfigMalformed = true ;
46+ core . warning ( `Unable to parse config file ${ path . join ( Docker . configDir , 'config.json' ) } : ${ e } ` ) ;
47+ }
48+ if ( dockerConfig && dockerConfig . proxies ) {
49+ for ( const host in dockerConfig . proxies ) {
50+ let prefix = '' ;
51+ if ( Object . keys ( dockerConfig . proxies ) . length > 1 ) {
52+ prefix = ' ' ;
53+ core . info ( host ) ;
54+ }
55+ for ( const key in dockerConfig . proxies [ host ] ) {
56+ core . info ( `${ prefix } ${ key } : ${ dockerConfig . proxies [ host ] [ key ] } ` ) ;
57+ }
58+ }
59+ } else if ( ! dockerConfigMalformed ) {
60+ core . info ( 'No proxy configuration found' ) ;
61+ }
62+ } ) ;
63+
3764 if ( ! ( await toolkit . buildx . isAvailable ( ) ) ) {
3865 core . setFailed ( `Docker buildx is required. See https://github.com/docker/setup-buildx-action to set up buildx.` ) ;
3966 return ;
0 commit comments