Skip to content

Add the validate-config Action#2030

Draft
dscho wants to merge 11 commits intomainfrom
validate-config
Draft

Add the validate-config Action#2030
dscho wants to merge 11 commits intomainfrom
validate-config

Conversation

@dscho
Copy link
Member

@dscho dscho commented Oct 6, 2025

In the CygwinGitGadget org, I guinea-pigged standing up GitGitGadget for a project other than Git. One of the most important steps was to configure GitGitGadget, via a combination of a config branch and the vars.CONFIG repository variable (which is now synchronized from the config branch via the "Synchronize config to the repository variable" workflow.

One problem I faced during the intricately-interdependent development of all this (in the github-action -- and the v1 -- branch of https://github.com/dscho/gitgitgadget/, in the main and config branches of https://github.com/cygwingitgadget/gitgitgadget-workflows/, and in the main branch of https://github.com/cygwingitgadget/gitgitgadget-github-app) was that the schema of the IConfig interface needed to change at times. And it was not all that easy to verify that the gitgitgadget-config.json file in the config branch stayed up to date.

Here is the result of those complications: a GitHub Action that is used in the validate-config workflow on the config branch (which is triggered via push, but the plan is of course to also have one on the main branch that can be triggered via a workflow_dispatch). This allows re-validating the config after schema changes.

This PR is stacked on top of #1991 and #2029.

dscho added 11 commits October 7, 2025 09:19
In my endeavor to support projects other than Git, I am currently
adapting GitGitGadget to allow sending Cygwin PRs to the Cygwin-patches
mailing list.

I identified a couple of gaps in the project configuration when setting
up stuff in https://github.com/cygwingitgadget.

Let's close those gaps.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
We've settled on the nomenclature `upstream-repo` to refer to the
original repository of the project, as opposed to the `pr-repo` which is
a fork that exists exclusively to let GitGitGadget handle PRs in (and to
store its global state in the Git notes). So let's call the owner of the
`upstream-repo` the `upstreamOwner`, not the `baseOwner`.

Besides, with GitHub's naming conventions referring to the branch a PR
targets as the "base", it is a bit confusing to have `baseOwner` to
refer to anything except the owner of the repository in which the PR
lives.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
The `owners` array refers to a list of orgs/owners where the GitHub App
is installed, i.e. where GitGitGadget can operate.

Therefore, a much better place is `app.installedOn`.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
The idea is to configure GitGitGadget via a `gitgitgadget-config.json`
file that contains the project-specific instance of the `IConfig`
interface, tracked in the `config` branch of a fork of the
`gitgitgadget-workflows` repository, from where it is automatically
synchronized via a GitHub workflow to the repository variable `CONFIG`,
and then passed to all of GitGitGadget's Actions via:

	```yml
	config: '${{ vars.CONFIG }}'
	```

For now, this input is optional, to ease the transition of GitGitGadget;
Eventually, this config will be required, so that several projects can
be served using identical source code in forks of the
`gitgitgadget-github-app` and `gitgitgadget-workflows` repositories.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
GitGitGadget now accepts the project configuration as a `config` Action
input, in the form of a string that contains the JSON-encoded `IConfig`
object. That is a bit fragile, though, as it is all-too-easy to have a
typo in that object.

Let's install `typia` to use the `IConfig` interface as a source of
truth when validating the user input.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This uses the freshly-installed `typia` module to create a validator for
the `IConfig` interface at compile-time, and uses it to validate
user-provided JSON against that interface.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
For the `typia`-based validator, it is good to label each and every
attribute's type so that the error messages are helpful.

This commit is best viewed with `--ignore-space-change`.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This way, the maximal number of columns can be configured freely per
project, via the project-specific config.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Currently this URL is constructed from the `host` and the `name`
attributes of the project config setting's `mailrepo` attribute.

However, the `name` is supposed to refer to the mailing list _mirror
repository_, while we are interested in the URL where the web UI of the
public-inbox instance lives. Luckily, we already have that in the
project configuration: It's the `url` attribute.

I noticed the need for this patch in
cygwingitgadget/cygwin#1, where the URL
displayed after submitting v1 pointed to an incorrect location.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This will come in handy once the project-specific settings start living
in the `config` branch.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant