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

markdown ifversion bleeding into user view for workflow-syntax-for-github-actions example-3 #13040

Open
1 task done
jsoref opened this issue Dec 16, 2021 · 6 comments
Open
1 task done

Comments

@jsoref
Copy link
Contributor

@jsoref jsoref commented Dec 16, 2021

Code of Conduct

What article on docs.github.com is affected?

https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions#example-3

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

The {% ifversion ... %} content shouldn't be rendered to end users, it appears like this to me:

on: 
  workflow_dispatch:
    inputs:
      logLevel:
        description: 'Log level'     
        required: true
        default: 'warning' {% ifversion ghec or ghes > 3.3 or ghae-issue-5511 %}
        type: choice
        options:
        - info
        - warning
        - debug {% endif %}
      tags:
        description: 'Test scenario tags'
        required: false {% ifversion ghec or ghes > 3.3 or ghae-issue-5511 %}
        type: boolean
      environment:
        description: 'Environment to run tests against'
        type: environment
        required: true {% endif %}
  
jobs:
  print-tag:
    runs-on: ubuntu-latest

    steps:
      - name: Print the input tag to STDOUT
        run: echo The tag is ${{ github.event.inputs.tag }}
Click for an image showing the problem...

image

Additional information

I think this was introduced by: ad605a4


Added by a maintainer

Content design plan

The condition that's being wrongly displayed in the example was added by the commit highlighted by @jsoref. This condition originally worked as intended, however, a later commit added {% raw %} tags around the whole example. This stopped the liquid versioning being parsed and means that it is now displayed.

You can fix this problem by moving the {% raw %} and {% endraw %} tags into the example, so that they just enclose ${{ github.event.inputs.tag }} on line 329 instead of the whole example. As shown in the style guide example: https://github.com/github/docs-internal/blob/main/contributing/content-style-guide.md#code-blocks).

@ramyaparimi
Copy link
Collaborator

@ramyaparimi ramyaparimi commented Dec 16, 2021

@jsoref Thank you for opening this issue. We appreciate how you clearly mentioned what the issue is with screenshot and what could have caused it. I will get this triaged for a writers review 👀

@felicitymay
Copy link
Contributor

@felicitymay felicitymay commented Jan 5, 2022

Hi @jsoref - thanks for flagging this.

I'm a little puzzled by this bug because I can see that this syntax usually works as expected (see source and output Configuring code scanning - Analyzing Python dependencies).

I'll ask docs engineering to take a look as it seems like it may be a rendering bug rather than a bug in the source file.

@jsoref
Copy link
Contributor Author

@jsoref jsoref commented Jan 5, 2022

Thanks.

Fwiw, my guess is that it's because you're inside a ``` block.

@felicitymay
Copy link
Contributor

@felicitymay felicitymay commented Jan 5, 2022

That's what I wondered about too, but the example I linked in my comment uses the same syntax successfully so clearly this does normally work. I couldn't see an obvious difference in the source files for the correctly displayed and incorrectly displayed code blocks. 🤔

@felicitymay
Copy link
Contributor

@felicitymay felicitymay commented Jan 5, 2022

It looks as if after the PR that you spotted was merged, a later PR added {% raw %} tags around the whole example. This stops the liquid versioning being parsed.

This issue can be fixed by moving the {% raw %} and {% endraw %} tags so that they just enclose ${{ github.event.inputs.tag }} on line 329 instead of the whole example. As shown in the example in the style guide.

Is this something you're able to fix? If not, I'll update the description of the issue and add a help wanted label.

@jsoref
Copy link
Contributor Author

@jsoref jsoref commented Jan 5, 2022

Ah, missed the raw.
Please be my guest.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
@felicitymay @jsoref @ramyaparimi and others