chore(ci): allow to specify provider to update servers data on dispatch

This commit is contained in:
Quentin McGaw
2026-03-04 19:24:53 +00:00
parent a8ee1d7a63
commit 4bcbd29fb9
2 changed files with 76 additions and 1 deletions
@@ -1,9 +1,12 @@
package providers
import (
"os"
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"gopkg.in/yaml.v3"
)
func Test_All(t *testing.T) {
@@ -21,3 +24,33 @@ func Test_AllWithCustom(t *testing.T) {
assert.Contains(t, all, Custom)
assert.Len(t, all, len(All())+1)
}
func TestWorkflowHasAll(t *testing.T) {
t.Parallel()
const path = "../../../.github/workflows/update-servers-list.yml"
file, err := os.Open(path)
require.NoError(t, err)
defer file.Close()
var data struct {
On struct {
WorkflowDispatch struct {
Inputs struct {
Provider struct {
Options []string `yaml:"options"`
} `yaml:"provider"`
} `yaml:"inputs"`
} `yaml:"workflow_dispatch"`
} `yaml:"on"`
}
decoder := yaml.NewDecoder(file)
err = decoder.Decode(&data)
require.NoError(t, err)
providers := All()
expected := make([]string, len(providers)+1)
expected[0] = "all"
copy(expected[1:], providers)
assert.Equal(t, expected, data.On.WorkflowDispatch.Inputs.Provider.Options)
}