Skip to content

Commit abdf26c

Browse files
committed
Convert from json to yaml for registries input
1 parent b044362 commit abdf26c

5 files changed

Lines changed: 26 additions & 14 deletions

File tree

init/action.yml

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,31 @@ inputs:
1010
description: The languages to be analysed
1111
required: false
1212
token:
13-
description: GitHub token to use for authenticating with this instance of GitHub. To download custom packs from multiple registries, use registries-auth-tokens.
13+
description: GitHub token to use for authenticating with this instance of GitHub. To download custom packs from multiple registries, use the registries input.
1414
default: ${{ github.token }}
1515
required: false
1616
registries:
1717
description: |
18-
Authenticate to GitHub Enterprise Server Container registries by passing a comma-separated list of <registry_url>=<token> pairs.
18+
A YAML string that defines the list of GitHub container registries to use for downloading packs. The string is in the following forma (the | is required on the first line):
1919
20-
For example, you can pass `https://containers.GHEHOSTNAME1/v2/=TOKEN1,https://containers.GHEHOSTNAME2/v2/=TOKEN2`` to authenticate to two GitHub Enterprise Server instances.
21-
This overrides the `token` input for pack downloads.
20+
registries: |
21+
- url: https://containers.GHEHOSTNAME1/v2/
22+
packages:
23+
- my-company/*
24+
- my-company2/*
25+
token: ${{ secrets.GHEHOSTNAME1_TOKEN }}
26+
27+
- url: https://ghcr.io/v2/
28+
packages: */*
29+
token: ${{ secrets.GHCR_TOKEN }}
30+
31+
The url property contains the url to the container registry you want to connect to.
32+
33+
The packages property contains a single entry or a list of globs specifying packages that can be found in the container registry. Order is important. Earlier entries will match before later entries.
34+
35+
The token property contains a connection token for this registry.
36+
37+
If this input is missing, the `token` input is used for all pack downloads.
2238
required: false
2339
matrix:
2440
default: ${{ toJson(matrix) }}

lib/config-utils.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/config-utils.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pr-checks/checks/init-with-registries.yml

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,9 @@ steps:
1515
config-file: ./.github/codeql/codeql-config-registries.yml
1616
languages: javascript
1717
registries: |
18-
[
19-
{
20-
"url": "https://ghcr.io/v2/",
21-
"packages": "*/*",
22-
"token": "${{ secrets.GITHUB_TOKEN }}"
23-
}
24-
]
18+
- url: "https://ghcr.io/v2/",
19+
packages: "*/*",
20+
token: "${{ secrets.GITHUB_TOKEN }}"
2521
2622
env:
2723
TEST_MODE: true

src/config-utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1723,7 +1723,7 @@ export async function initConfig(
17231723

17241724
function parseRegistries(registriesInput: string | undefined) {
17251725
try {
1726-
return registriesInput ? JSON.parse(registriesInput) : undefined;
1726+
return registriesInput ? yaml.l(registriesInput) : undefined;
17271727
} catch (e) {
17281728
throw new Error(
17291729
`Invalid registries input. Must be a JSON string, but got: ${

0 commit comments

Comments
 (0)