Skip to content

Commit a8887ae

Browse files
fix: honor the type input as an alias of platform_type
1 parent 2e9a345 commit a8887ae

3 files changed

Lines changed: 8 additions & 1 deletion

File tree

‎entrypoint.sh‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ set --
2424
[[ ! -z "$INPUT_EXCLUDE_QUERIES" ]] && EXCLUDE_QUERIES_PARAM="--exclude-queries $INPUT_EXCLUDE_QUERIES"
2525
[[ ! -z "$INPUT_EXCLUDE_CATEGORIES" ]] && EXCLUDE_CATEGORIES_PARAM="--exclude-categories $INPUT_EXCLUDE_CATEGORIES"
2626
[[ "$INPUT_EXCLUDE_GITIGNORE" == "true" ]] && EXCLUDE_GITIGNORE="--exclude-gitignore"
27+
INPUT_PLATFORM_TYPE="${INPUT_PLATFORM_TYPE:-$INPUT_TYPE}"
2728
[[ ! -z "$INPUT_PLATFORM_TYPE" ]] && PLATFORM_TYPE_PARAM="--type $INPUT_PLATFORM_TYPE"
2829
[[ ! -z "$INPUT_FAIL_ON" ]] && FAIL_ON_PARAM="--fail-on $INPUT_FAIL_ON"
2930
[[ ! -z "$INPUT_TIMEOUT" ]] && TIMEOUT_PARAM="--timeout $INPUT_TIMEOUT"

‎test/e2e/action-contract.test.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const consumed = new Set([
1616
])
1717
consumed.delete('INPUT_PARAM') // entrypoint.sh's own "-p <path>" variable, not an action input
1818

19-
const KNOWN_UNUSED_INPUTS = { type: 'declared in action.yml but entrypoint.sh only reads platform_type, so `type:` is silently ignored' }
19+
const KNOWN_UNUSED_INPUTS = {}
2020

2121
test('action.yml parsing assumptions hold', async (t) => {
2222
await t.test('declares inputs and the runs.env mappings the tests rely on', () => {

‎test/e2e/entrypoint.test.js‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ test('inputs mapped to KICS flags', async (t) => {
6363
['exclude_queries', '11111111-2222-3333-4444-555555555555', '--exclude-queries'],
6464
['exclude_categories', 'Observability,Backup', '--exclude-categories'],
6565
['platform_type', 'Terraform,Dockerfile', '--type'],
66+
['type', 'Ansible,Dockerfile', '--type'],
6667
['fail_on', 'high,medium', '--fail-on'],
6768
['timeout', '60', '--timeout'],
6869
['profiling', 'CPU', '--profiling'],
@@ -79,6 +80,11 @@ test('inputs mapped to KICS flags', async (t) => {
7980
})
8081
}
8182

83+
await t.test('platform_type wins when type is set as well', async (t) => {
84+
const run = await runEntrypoint(t, { inputs: { platform_type: 'Terraform', type: 'Ansible' } })
85+
assert.equal(flagValue(run.args, '--type'), 'Terraform')
86+
})
87+
8288
const withSpaces = [
8389
['payload_path', 'my dir/payload file.json', '-d'],
8490
['config_path', 'my dir/kics config.json', '--config'],

0 commit comments

Comments
 (0)