actionlint icon indicating copy to clipboard operation
actionlint copied to clipboard

Single quote check is missed in presence of ${{ }} in if

Open varungandhi-src opened this issue 3 years ago • 1 comments

Minimal example:

name: test
on:
  push:
jobs:
  x:
    runs-on: ubuntu-latest
    if: ${{ github.repository }} == "a/a"
    steps:
    - name: a
      run: echo "a"

This doesn't emit any errors.

However, there is an error about double quotes if you replace ${{ github.repository }} with github.repository, which seems like the right behavior based on https://github.com/actions/runner/issues/866. Would it make sense to emit the same error when ${{ github.repository }} is used?

varungandhi-src avatar Feb 05 '22 03:02 varungandhi-src

This is very edge case of if: usage. if: specially allow an expression without ${{ }} in its body so it allows nesting ${{ }} but actionlint is not supporting that. In your example, including the equal expression within a single ${{ }} would be cleaner.

if: ${{ github.repository == 'a/a' }}

rhysd avatar Apr 13 '22 12:04 rhysd