Skip to content

Commit

Permalink
Resolve actions command warning
Browse files Browse the repository at this point in the history
If line and endLine are different (like a range usually is), then it can't cope with col and endColumn being set:

```
Invalid error command value. 'col' and 'endColumn' cannot be set if 'line' and 'endLine' are different values.
```
  • Loading branch information
dflook committed Jan 23, 2025
1 parent 9053410 commit 1f6b98a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions image/tools/convert_validate_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@ def convert_to_github(report: Dict, base_path: str) -> Iterable[str]:
params['endLine'] = diag['range']['end']['line']
params['endColumn'] = diag['range']['end']['column']

if params.get('line') != params.get('endLine'):
# GitHub can't cope with 'col' and 'endColumn' if 'line' and 'endLine' are different values.
if 'col' in params:
del params['col']
if 'endColumn' in params:
del params['endColumn']

summary = diag['summary'].split('\n')[0]
params = ','.join(f'{k}={v}' for k, v in params.items())

Expand Down
2 changes: 1 addition & 1 deletion tests/test_validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def test_invalid_paths():

expected_output = [
'::error file=tests/validate/invalid/main.tf,line=2,col=1,endLine=2,endColumn=33::Duplicate resource "null_resource" configuration',
'::error file=tests/validate/module/invalid.tf,line=2,col=1,endLine=5,endColumn=66::Duplicate resource "null_resource" configuration'
'::error file=tests/validate/module/invalid.tf,line=2,endLine=5::Duplicate resource "null_resource" configuration'
]

output = list(convert_to_github(input, 'tests/validate/invalid'))
Expand Down

0 comments on commit 1f6b98a

Please sign in to comment.