Add `configlet fmt` to CI

I suggest adding the formatting check of configlet fmt to the CI workflow. It should be enabled with a workflow configuration switch, so tracks can choose to have it. When enabled, it should bail out if formatting is required. It should not auto-commit it, because that does not work with PRs from contributors repositories and hides the real issue behind access rights failures.

Currently configlet create re-writes the config.json, which in turn re-formats the file. So if the file wasn’t formatted like configlet would do, the real changes are hidden by / mixed with unrelated formatting changes. This can be avoided with keeping the files formatted automatically. But there currently is no option to check that in CI.

When tracks don’t want auto-formatted JSON files, or when major updates to the command are done, opting out should be easy. Having a workflow configuration switch to enable it would do that nicely.

As all the configlet functionality is used organisation wide, I do not think it is reasonable to add it to each track individually.

There is though :) Just add a .github/org-wide-files-config.toml file to your repo with the following contents:

[configlet]
fmt = true

See csharp/.github/org-wide-files-config.toml at main · exercism/csharp · GitHub for an example.

1 Like

Thanks for pointing me to C# - I had to enable it in .github/workflows/configlet.yml using

jobs:
  configlet:
    uses: exercism/github-actions/.github/workflows/configlet.yml@main
    with:
      fmt: true

The TOML file seems not to be required at all. Or does the exercism-bot turn it off again without the TOML?

Yes, without the config file every time the workflow gets synced by the Exercism bot it will be reset to default.

Thanks everyone! Up and running…