Provides runner label completions (ubuntu-latest, macos-latest, etc.)
when using the runs-on mapping syntax with the labels property:
jobs:
build:
runs-on:
labels: |
jobs:
build:
runs-on:
labels:
- |
Previously, completions only worked for the simple runs-on syntax:
jobs:
build:
runs-on: |
The fix registers the same value provider for both 'runs-on' and
'runs-on-labels' definition keys in the schema.
43 lines
1.2 KiB
TypeScript
43 lines
1.2 KiB
TypeScript
import {ValueProviderConfig, ValueProviderKind} from "./config.js";
|
|
import {needs} from "./needs.js";
|
|
import {reusableJobInputs} from "./reusable-job-inputs.js";
|
|
import {reusableJobSecrets} from "./reusable-job-secrets.js";
|
|
import {stringsToValues} from "./strings-to-values.js";
|
|
|
|
export const DEFAULT_RUNNER_LABELS = [
|
|
"ubuntu-latest",
|
|
"ubuntu-24.04",
|
|
"ubuntu-22.04",
|
|
"ubuntu-20.04",
|
|
"ubuntu-slim",
|
|
"windows-latest",
|
|
"windows-2022",
|
|
"windows-2019",
|
|
"macos-latest",
|
|
"macos-15",
|
|
"macos-14",
|
|
"self-hosted"
|
|
];
|
|
|
|
const runsOnValueProvider = {
|
|
kind: ValueProviderKind.SuggestedValues,
|
|
get: () => Promise.resolve(stringsToValues(DEFAULT_RUNNER_LABELS))
|
|
};
|
|
|
|
export const defaultValueProviders: ValueProviderConfig = {
|
|
needs: {
|
|
kind: ValueProviderKind.AllowedValues,
|
|
get: context => Promise.resolve(needs(context))
|
|
},
|
|
"workflow-job-with": {
|
|
kind: ValueProviderKind.AllowedValues,
|
|
get: context => Promise.resolve(reusableJobInputs(context))
|
|
},
|
|
"workflow-job-secrets": {
|
|
kind: ValueProviderKind.SuggestedValues,
|
|
get: (context, existingValues) => Promise.resolve(reusableJobSecrets(context, existingValues))
|
|
},
|
|
"runs-on": runsOnValueProvider,
|
|
"runs-on-labels": runsOnValueProvider
|
|
};
|