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

Conditional on a job fails if double quotes are used #866

Closed
djolez opened this issue Dec 17, 2020 · 6 comments
Closed

Conditional on a job fails if double quotes are used #866

djolez opened this issue Dec 17, 2020 · 6 comments
Assignees
Labels
Service Bug Bug fix scope to the pipelines service and launch app

Comments

@djolez
Copy link

djolez commented Dec 17, 2020

Describe the bug
Using double quotes in a conditional for a job results in

The workflow is not valid. <file_path>: Unexpected symbol: '"workflow_dispatch"'. Located at position 22 within expression: github.event_name != "workflow_dispatch"

To Reproduce
Steps to reproduce the behavior:

  1. Create a job with a conditional
test-job:
    name: Use double quotes
    if: github.event_name != "workflow_dispatch"
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@v2
  1. Run it
  2. See above mentioned error
  3. Use single quotes instead if: github.event_name != 'workflow_dispatch', it works

Expected behavior
Job should pass regardless of type of quotes used

Runner Version and Platform

2.274.2

OS of the machine running the runner? Ubuntu 18.04

What's not working?

N/A

Job Log Output

N/A

Runner and Worker's Diagnostic Logs

N/A

@djolez djolez added the bug Something isn't working label Dec 17, 2020
nschonni added a commit to nschonni/aria-common that referenced this issue Apr 27, 2021
nugaon added a commit to ethersphere/bee-factory that referenced this issue May 4, 2021
@memchenko
Copy link

Hi!
I got the same error with hashFiles("**/yarn.lock") when trying to cache node_modules using actions/cache@v2

afranke pushed a commit to matrix-org/matrix.org that referenced this issue Oct 6, 2021
GHA doesn’t like double quotes here apparently
actions/runner#866
michael-n-cooper pushed a commit to w3c/aria-common that referenced this issue Oct 13, 2021
aduros added a commit to aduros/wasm4 that referenced this issue Oct 21, 2021
@solarmosaic-kflorence
Copy link

Ran into this as well #834 (comment) 😕

@drecali
Copy link

drecali commented Nov 12, 2021

@djolez @solarmosaic-kflorence
According to the docs it seems like this is the intended behavior.

You must use single quotes. Escape literal single-quotes with a single quote.

myString: ${{ 'Mona the Octocat' }}

I just experienced this problem and it was quite inconvenient to debug. I thought single or double quotes didn't matter. I know actions use YAML syntax but I'm not clear what syntax Expressions use. It would be great if it's possible to allow the use of both types of quotes inside Expressions.

I'll include this in case it helps anyone debug. In my case the action failed with a status Startup failure. I included the errors I got below. I suspected the double quotes because the double quoted string was referred to as a symbol and included the double quotes. I would expect a symbol to be a special character like an escape sequence such as \n. I read this page of the YAML docs and I didn't understand clearly why double quotes might not be allowed in this case.(https://www.yaml.info/learn/quote.html).

Invalid workflow file : .github/workflows/cypress-tests.yml#L32
The workflow is not valid. .github/workflows/cypress-tests.yml (Line: 32, Col: 13): Unexpected symbol: '"--t"'. Located at position 44 within expression: contains(github.event.head_commit.message, "--t")

Here is the line of code responsible:

if: contains(github.event.head_commit.message, "--t")

Here is the same line with single quotes. This works:

if: contains(github.event.head_commit.message, '--t')

@solarmosaic-kflorence
Copy link

@drecali I'm aware that the documentation mentions only single quote is valid (after the fact, of course). However, I think that behavior is not intuitive, since double quotes are valid throughout the rest of the YAML syntax. Unless there is a good reason not to support double quotes, it should be fixed.

@drecali
Copy link

drecali commented Nov 15, 2021

@solarmosaic-kflorence
I agree with you 100%. I didn't see a link to the specific line in the documentation or in #834 so I wanted to add it. The docs were mentioned quite far up the comment thread in #834 so that's why I added the link here and tagged you because you referred that issue here. I hope expressions become quote-agnostic soon, or at least I'd like to understand technical reasons why that may not be possible/ideal.

jctrouble added a commit to CoreSwift/ServiceLocator that referenced this issue Nov 27, 2021
copybara-service bot pushed a commit to google/etils that referenced this issue Jan 6, 2022
It seems github action only accept single-quotes: actions/runner#866

PiperOrigin-RevId: 419596027
copybara-service bot pushed a commit to google/etils that referenced this issue Jan 7, 2022
It seems github action only accept single-quotes: actions/runner#866

PiperOrigin-RevId: 419596027
copybara-service bot pushed a commit to google/etils that referenced this issue Jan 7, 2022
It seems github action only accept single-quotes: actions/runner#866

PiperOrigin-RevId: 420270640
@thboop thboop added Service Bug Bug fix scope to the pipelines service and launch app and removed bug Something isn't working labels Jan 28, 2022
ltalirz added a commit to aiidateam/aiida-plugin-cutter that referenced this issue Feb 24, 2022
@ruvceskistefan ruvceskistefan self-assigned this Mar 4, 2022
@ruvceskistefan
Copy link
Contributor

GitHub Actions only support the use of single quotes for strings in expression language, not double quotes (see docs). This is an intentional limitation (at least for now) and is not something that can be fixed in the runner application. Therefore, I'm going to close this issue, and you feel free to create a feature request on the GitHub Community Support Forum which is actively monitored. Using the forum ensures that we route your feature request to the correct team. 😃

Abhiek187 added a commit to Abhiek187/abhiek187.github.io that referenced this issue Mar 29, 2022
tillahoffmann added a commit to tillahoffmann/template that referenced this issue May 11, 2022
rlmartin added a commit to rlmartin/cdktf-provider-project that referenced this issue Oct 13, 2022
ryanmcafee added a commit to JupiterOne-Archives/velero-plugin-for-csi that referenced this issue Jan 11, 2023
t-kalinowski added a commit to guildai/guildai-r that referenced this issue Jan 13, 2023
PaulRBerg added a commit to sablier-labs/lockup that referenced this issue May 27, 2023
PaulRBerg added a commit to sablier-labs/lockup that referenced this issue May 27, 2023
PaulRBerg added a commit to sablier-labs/lockup that referenced this issue May 27, 2023
PaulRBerg added a commit to sablier-labs/lockup that referenced this issue May 27, 2023
PaulRBerg added a commit to sablier-labs/lockup that referenced this issue May 27, 2023
martibosch added a commit to martibosch/pylandstats that referenced this issue Aug 11, 2023
martibosch added a commit to martibosch/pylandstats that referenced this issue Aug 11, 2023
scarf005 added a commit to cataclysmbnteam/Cataclysm-BN that referenced this issue Jul 16, 2024
scarf005 added a commit to cataclysmbnteam/Cataclysm-BN that referenced this issue Jul 16, 2024
* ci: fix workflow dispatch getting cancelled

workaround for daily release not running.
skip number of commits check on manual experimental release.

* ci: use single quote

actions/runner#866

* ci: fix no release note on day after no commit

use last tag instead of last date on fromTag

* ci: always show changelog

* ci: try using cat

* ci: update existing release
vanyauhalin added a commit to vanyauhalin/eslint-config that referenced this issue Jan 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Service Bug Bug fix scope to the pipelines service and launch app
Projects
None yet
Development

No branches or pull requests

6 participants