github / docs

The open-source repo for docs.github.com
https://docs.github.com
Creative Commons Attribution 4.0 International
15.8k stars 58.69k forks source link

Publishing Docker images page contains broken YML code #33794

Open snorremd opened 2 weeks ago

snorremd commented 2 weeks ago

Code of Conduct

What article on docs.github.com is affected?

All articles using the {% data reusables.actions.artifact-attestations-step-for-container-images %} template. For example: https://github.com/github/docs/blob/main/content/actions/publishing-packages/publishing-docker-images.md

Specifically the problem is that the attestations-step-for-container-images is using an asterisk * instead of a dash - in the example.

Now it looks like this:

      - name: Build and push Docker images
        id: push
        uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671
        with:
          context: .
          push: true
          tags: ${{ steps.meta.outputs.tags }}
          labels: ${{ steps.meta.outputs.labels }}

      * name: Generate artifact attestation
        uses: actions/attest-build-provenance@v1
        with:
          subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
          subject-digest: ${{ steps.push.outputs.digest }}
          push-to-registry: true

This can be confusing as one could believe the asterisk is some kind of special case.

What changes are you suggesting?

Change the https://github.com/github/docs/blob/main/data/reusables/actions/artifact-attestations-step-for-container-images.md file to use a - so the GitHub Actions examples using attestation step are not broken.

This also requires changing the setup so the linter does not complain. See my attempts at fixing this in closed PR: https://github.com/github/docs/pull/33793

Additional information

No response

welcome[bot] commented 2 weeks ago

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.

nguyenalex836 commented 2 weeks ago

@snorremd Thank you for opening an issue! I'll get this triaged for review ✨

subatoi commented 2 weeks ago

Thank you @snorremd — I suspect the linter just got overzealous at some point. You or anyone else is welcome to submit a PR with the suggested change (asterisk -> hyphen).

And thank you so much for raising an issue ✨

janbrasna commented 1 week ago

The linter is still angry:

data/reusables/actions/artifact-attestations-step-for-container-images.md
    ERROR
    Fixable!
    Rule        MD004, ul-style Unordered list style
    Detail      Expected: asterisk; Actual: dash
    Line        1      
ℹ 🕦 Markdownlint finished in 30.0 ms
✖ Found 1 file with error
Error: Process completed with exit code 1.

@subatoi Do I get the OP or anyone is expected to open a PR, and even with a failing CI it would get approved et al.?

subatoi commented 1 week ago

Hi @janbrasna — That's correct, provided that the error is the cause of the linter failure

janbrasna commented 1 week ago

OK thanks @subatoi — I wasn't sure whether the linter behav changed or had exceptions added for such case, and was surprised to see it still throwing on that YAML line. So I've reopened the PR with only the needed change cherry-picked from the OP's attempts leaving a note to expect the linting to fail to make sure a reviewer is aware of the context.