Fixes #23516
Fixes #20139 Refresh does not support dry-run, so don't run it in check mode. Also add a test for this case.
This change corrects problems reported by the `yamllint` linter. Since key duplication problems were removed in 4d48711, this commit mainly fixes trailing spaces and extra empty lines at beginning/end of files.
4d48711