# Saving comments in Bitrise.yml?

**URL:** <https://discuss.bitrise.io/t/saving-comments-in-bitrise-yml/423>\
**Category:** Question & Answer\
**Created:** [January 24, 2017, 7:58pm UTC](https://discuss.bitrise.io/t/saving-comments-in-bitrise-yml/423 "2017-01-24T19:58:49Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![mleatherb](https://avatars.discourse-cdn.com/v4/letter/m/a88e4f/32.png) [@mleatherb](https://discuss.bitrise.io/u/mleatherb)\
**Post date:** [January 24, 2017, 7:58pm UTC](https://discuss.bitrise.io/t/saving-comments-in-bitrise-yml/423/1 "2017-01-24T19:58:49Z")

</div>

I’m not 100% sure this is a bug, but If you make a comment in the bitrise.yml file and save, the comment is deleted.  
I found this out by commenting out a step and saving the file only to find out that the step was now removed.

---

<div class="post-metadata">

**Author:** ![viktorbenei](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.bitrise.io/viktorbenei/32/18_2.png) [@viktorbenei](https://discuss.bitrise.io/u/viktorbenei)\
**Post date:** [January 24, 2017, 8:26pm UTC](https://discuss.bitrise.io/t/saving-comments-in-bitrise-yml/423/2 "2017-01-24T20:26:25Z")

</div>

Unfortunately this is an issue with YAML itself. There’s no “comment” in the data structure you get if you parse a YML/YAML input, the YAML comments will simply be skipped when you parse YAML.

This means that if any tool reads in the YAML and then writes it out again as YAML, it can’t preserve the comments, as those are simply ignored **at read** / during the parsing.

For general comments in the `bitrise.yml` you should use the `description` properties, it’s supported on almost all levels, along with `title` and `summary`: [https://github.com/bitrise-io/bitrise/blob/master/\_docs/bitrise-yml-format-spec.md](https://github.com/bitrise-io/bitrise/blob/master/_docs/bitrise-yml-format-spec.md)

We also have plans to add some kind of “meta” tag to the `bitrise.yml` format, where you could store anything else, not just a string, but so far we didn’t see a significant demand for this.

> [@mleatherb](#):
>
> I found this out by commenting out a step and saving the file only to find out that the step was now removed.

For this the best solution is to use a backup of the yml. You can do this two ways:

1. In the Workflow Editor switch to `bitrise.yml` mode and download the yml from there
2. You can also get a build’s `bitrise.yml` right from the build’s page, and you can restore that yml any time you want to (e.g. by pasting it into `bitrise.yml` in the Workflow Editor).

---

<div class="post-metadata">

**Author:** ![viktorbenei](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.bitrise.io/viktorbenei/32/18_2.png) [@viktorbenei](https://discuss.bitrise.io/u/viktorbenei)\
**Post date:** [January 26, 2017, 6:26pm UTC](https://discuss.bitrise.io/t/saving-comments-in-bitrise-yml/423/3 "2017-01-26T18:26:12Z")

</div>

One more thing : if you want to disable a step you can do that by adding a `run_if: false` flag to the step. Related docs : [http://devcenter.bitrise.io/tips-and-tricks/disable-a-step-by-condition/#disable-a-step](http://devcenter.bitrise.io/tips-and-tricks/disable-a-step-by-condition/#disable-a-step)

---

<div class="post-metadata">

**Author:** ![koral](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.bitrise.io/koral/32/357_2.png) [@koral](https://discuss.bitrise.io/u/koral)\
**Post date:** [October 23, 2017, 2:25am UTC](https://discuss.bitrise.io/t/saving-comments-in-bitrise-yml/423/4 "2017-10-23T02:25:12Z")

</div>

Coming from [Comments in `bitrise.yml` lost when saving/loading · Issue #206 · bitrise-io/bitrise-workflow-editor · GitHub](https://github.com/bitrise-io/bitrise-workflow-editor/issues/206#issuecomment-337556836)

> [@viktorbenei](#):
>
> This means that if any tool reads in the YAML and then writes it out again as YAML, it can’t preserve the comments, as those are simply ignored at read / during the parsing.

I haven’t checked parser used by Bitrise however, parsers preserving comments do exist. For example: [ruamel.yaml · PyPI](https://pypi.python.org/pypi/ruamel.yaml)

> ruamel.yaml is a YAML parser/emitter that supports roundtrip preservation of comments, seq/map flow style, and map key order

So it might be a feature that comments are preserved if workflow is edited in `bitrise.yml` tab.

---

<div class="post-metadata">

**Author:** ![viktorbenei](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.bitrise.io/viktorbenei/32/18_2.png) [@viktorbenei](https://discuss.bitrise.io/u/viktorbenei)\
**Post date:** [October 23, 2017, 12:53pm UTC](https://discuss.bitrise.io/t/saving-comments-in-bitrise-yml/423/5 "2017-10-23T12:53:00Z")

</div>

Hi @koral, you’re right, some parsers might keep it. That said neither the Ruby nor the Go parser we use does.

To keep comments in the config please use the description, summary and where available `meta` tags in the yml. Those are guaranteed to be kept by every parser as those are part of the data.
