Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect documentation regarding omitting the expression syntax for if conditionals #8700

Closed
JojOatXGME opened this issue Aug 1, 2021 · 5 comments · Fixed by #8786
Closed
Labels
content This issue or pull request belongs to the Docs Content team

Comments

@JojOatXGME
Copy link

JojOatXGME commented Aug 1, 2021

What article on docs.github.com is affected?

What part(s) of the article would you like to see updated?

All the sections linked above contain the following snippet:

When you use expressions in an if conditional, you may omit the expression syntax (${{ }}) because GitHub automatically evaluates the if conditional as an expression, unless the expression contains any operators. If the expression contains any operators, the expression must be contained within ${{ }} to explicitly mark it for evaluation.

However, according to my own experience (and a lot of examples I find on the web), the exception (“unless the expression contains any operators”) does not seem to be true. For example, the expression of the following if is evaluated.

jobs:
  my-job:
    runs-on: ubuntu-latest
    if: github.event_name == 'push' && github.ref == 'refs/heads/master'

Note that == and && are both operators. I think it is pretty confusing that a lot of examples on the web omit ${{ }} while the documentation claims that it would not work.

@JojOatXGME JojOatXGME added the content This issue or pull request belongs to the Docs Content team label Aug 1, 2021
@welcome
Copy link

welcome bot commented Aug 1, 2021

Thanks for opening this issue. A GitHub docs team member should be by to give feedback soon. In the meantime, please check out the contributing guidelines.

@github-actions github-actions bot added the triage Do not begin working on this issue until triaged by the team label Aug 1, 2021
@ramyaparimi
Copy link
Contributor

@JojOatXGME Thanks so much for opening an issue! I'll triage this for the team to take a look 👀

@ramyaparimi ramyaparimi removed the triage Do not begin working on this issue until triaged by the team label Aug 2, 2021
@lucascosti
Copy link
Contributor

Thanks for raising this, @JojOatXGME; I can confirm this behavior as well, but I'll double-check with engineering that the current behavior is intended.

@lucascosti
Copy link
Contributor

Confirmed with engineering that it's not necessary 👍. PR opened here: #8786

@JojOatXGME
Copy link
Author

Thanks for fixing the documentation. Good to know that my confusion was not caused by some fundamental misconception on my site. :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
content This issue or pull request belongs to the Docs Content team
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants
@JojOatXGME @lucascosti @ramyaparimi and others