github / github/vscode-github-actions

`if` conditional marked as error if the YAML string is double quoted

Đang mở
#60 4 bình luận 7 reaction 0 người được giao Xem trên GitHub
bug
Ngôn ngữ chính
TypeScript
Star
660
Fork
213
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

**Describe the bug**
I have an `if` in my workflow that looks like this:
```yaml
if: "!startsWith(matrix.os, 'ubuntu-')"
```

The conditional is quoted because `!` has meaning in YAML to change the type, so we can't start a string with that character without a way to tell the YAML parser it's a string. **This works fine in the workflow.**

However, it's marked as an error by this extension:

> Unexpected symbol: '"'. Located at position 1 within expression: "!startsWith(matrix.os, 'ubuntu-')"

**Workarounds that work**
* Single quotes (**NOTE** double quotes can't be used inside expression apparently)
* YAML multi-line strings
* Unnecessary templating

```yaml
---
# Note double single quotes internally
if: '!startsWith(matrix.os, ''ubuntu-'')'

---
if: >-
!startsWith(matrix.os, 'ubuntu-')

---
if: ${{ !startsWith(matrix.os, 'ubuntu-') }}
```

**Workarounds that don't work**
* explicit `str` typing

```yaml
---
if: !!str !startsWith(matrix.os, 'ubuntu-')
```

**To Reproduce**
Use a double quoted condition.

**Expected behavior**
No error.

**Screenshots**
![image](https://user-images.githubusercontent.com/1260690/228541620-d2aac670-d445-4b49-ba4e-26e841c63cfb.png)

**Extension Version**
`v0.25.3`

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.