"bad identation of a mapping entry"

I copied what I was given, and this error doesn’t make any sense. I’ve gotten this error a lot when I was first writing YAML, and it’s always made no sense. Is this time an actual bug with GitHub itself?

Link to full code: JavascriptLearner815.github.io/main.yml at 542b6602dcd71b0a38c3409912011055df00b8ad · JavascriptLearner815/JavascriptLearner815.github.io · GitHub

I have tried changing indentation, using -, and adding a value, and combining all of those. No avail.

The problem is that you mix a string assignment and dictionary assignment here, leading to syntax errors:

        with: ${{ secrets.PAT_TOKEN }}
          github_token: # optional, default is ${{ github.token }}

In terms of YAML syntax, this would be a valid string assignment (but invalid for Actions config!) making with a string with the value ${{ secrets.PAT_TOKEN }}:

        with: ${{ secrets.PAT_TOKEN }}

The following makes with a dictionary, with github_token one of its elements (which happens to be a string):

        with:
          github_token: 'abc'

For the uses step, with must be a dictionary. If you want to use your PAT instead of the default token, you must put ${{ secrets.PAT_TOKEN }} where 'abc' is in the example above.

1 Like