Skip to content

Commit 898802b

Browse files
committed
feat(php-prefixer): Support schema parameter
1 parent b7f618a commit 898802b

File tree

4 files changed

+31
-6
lines changed

4 files changed

+31
-6
lines changed

__tests__/env-helper.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ beforeEach(async () => {
1616
projectId: 'INPUT_PROJECT_ID',
1717
sourceDirPath: 'SOURCE_DIR_PATH',
1818
targetDirPath: mockedTargetPath,
19-
ghPersonalAccessToken: 'GH_PERSONAL_ACCESS_TOKEN'
19+
ghPersonalAccessToken: 'GH_PERSONAL_ACCESS_TOKEN',
20+
schema: ''
2021
}
2122
})
2223

action.yml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,23 @@ description: 'Prefix PHP libraries and projects. PHP-Prefixer is a service to ap
44

55
inputs:
66
personal_access_token:
7-
description: 'The PHP-Prefixer PAT/Personal Access Token. The token must be configured in the PHP-Prefixer account. Example: `789|1234567890123456789012345678901234567890`.'
7+
description: >
8+
The PHP-Prefixer PAT/Personal Access Token. The token must be configured in the
9+
PHP-Prefixer account. Example: `789|1234567890123456789012345678901234567890`.
810
required: true
911
project_id:
10-
description: 'The project ID to process the source code. The project must be configured in your account in the PHP-Prefixer account. Example: `5123`.'
12+
description: >
13+
The project ID to process the source code. The project must be configured in your
14+
account in the PHP-Prefixer account. Example: `5123`.
1115
required: true
16+
schema:
17+
description: >
18+
The PHP-Prefixer JSON configuration to be applied to the project. By default,
19+
the prefixer uses the configuration present in composer.json. If there is no extra
20+
configuration or the extra configuration must be replaced, this parameter overrides
21+
the composer.json extra configuration to define the PHP-Prefixer schema. Example:
22+
'{"project-name": "Prefixed Project","namespaces-prefix": "PPP","global-scope-prefix": "PPP_"}'
23+
required: false
1224
token:
1325
description: >
1426
Personal access token (PAT) used to fetch the repository. The PAT is configured

src/input-helper.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ export function getInputs(): IPhpPrefixerSettings {
4040
throw new Error('project_id not defined')
4141
}
4242

43+
result.schema = core.getInput('schema')
44+
4345
return result
4446
}
4547

src/php-prefixer-settings.ts

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,27 @@ export interface IPhpPrefixerSettings {
1010
targetDirPath: string
1111

1212
/**
13-
* Personal Access Token: The personal access token, generated on PHP-Prefixer Account Settings
13+
* Personal Access Token: The personal access token, generated on PHP-Prefixer Account Settings.
1414
*/
1515
personalAccessToken: string
1616

1717
/**
18-
* Project ID: The identification of the configured project on PHP-Prefixer Projects
18+
* Project ID: The identification of the configured project on PHP-Prefixer Projects.
1919
*/
2020
projectId: string
2121

2222
/**
23-
* GitHub Access Token: An optional GitHub token to access composer.json dependencies that are managed in private repositories.
23+
* GitHub Access Token: An optional GitHub token to access composer.json dependencies
24+
* that are managed in private repositories.
2425
*/
2526
ghPersonalAccessToken: string
27+
28+
/**
29+
* PHP-Prefixer Schema: The PHP-Prefixer JSON configuration to be applied to the project. By default,
30+
the prefixer uses the configuration present in composer.json. If there is no extra
31+
configuration or the extra configuration must be replaced, this parameter overrides
32+
the composer.json extra configuration to define the PHP-Prefixer schema. Example:
33+
'{"extra": {"php-prefixer": {"project-name": "Prefixed Project","namespaces-prefix": "PPP","global-scope-prefix": "PPP_"}}}'
34+
*/
35+
schema: string
2636
}

0 commit comments

Comments
 (0)