Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit8fe8b24

Browse files
committed
Addgit_source as supported registry type for Go
1 parent6242bcb commit8fe8b24

File tree

3 files changed

+24
-15
lines changed

3 files changed

+24
-15
lines changed

‎lib/start-proxy-action.js‎

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

‎src/start-proxy.test.ts‎

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,14 @@ setupTests(test);
1111
consttoEncodedJSON=(data:any)=>
1212
Buffer.from(JSON.stringify(data)).toString("base64");
1313

14+
constmixedCredentials=[
15+
{type:"npm_registry",host:"npm.pkg.github.com",token:"abc"},
16+
{type:"maven_repository",host:"maven.pkg.github.com",token:"def"},
17+
{type:"nuget_feed",host:"nuget.pkg.github.com",token:"ghi"},
18+
{type:"goproxy_server",host:"goproxy.example.com",token:"jkl"},
19+
{type:"git_source",host:"github.com/github",token:"mno"},
20+
];
21+
1422
test("getCredentials prefers registriesCredentials over registrySecrets",async(t)=>{
1523
constregistryCredentials=Buffer.from(
1624
JSON.stringify([
@@ -94,13 +102,6 @@ test("getCredentials throws error when credential missing host and url", async (
94102
});
95103

96104
test("getCredentials filters by language when specified",async(t)=>{
97-
constmixedCredentials=[
98-
{type:"npm_registry",host:"npm.pkg.github.com",token:"abc"},
99-
{type:"maven_repository",host:"maven.pkg.github.com",token:"def"},
100-
{type:"nuget_feed",host:"nuget.pkg.github.com",token:"ghi"},
101-
{type:"goproxy_server",host:"goproxy.example.com",token:"jkl"},
102-
];
103-
104105
constcredentials=startProxyExports.getCredentials(
105106
getRunnerLogger(true),
106107
undefined,
@@ -111,13 +112,21 @@ test("getCredentials filters by language when specified", async (t) => {
111112
t.is(credentials[0].type,"maven_repository");
112113
});
113114

115+
test("getCredentials returns all for a language when specified",async(t)=>{
116+
constcredentials=startProxyExports.getCredentials(
117+
getRunnerLogger(true),
118+
undefined,
119+
toEncodedJSON(mixedCredentials),
120+
"go",
121+
);
122+
t.is(credentials.length,2);
123+
124+
constcredentialsTypes=credentials.map((c)=>c.type);
125+
t.assert(credentialsTypes.includes("goproxy_server"));
126+
t.assert(credentialsTypes.includes("git_source"));
127+
});
128+
114129
test("getCredentials returns all credentials when no language specified",async(t)=>{
115-
constmixedCredentials=[
116-
{type:"npm_registry",host:"npm.pkg.github.com",token:"abc"},
117-
{type:"maven_repository",host:"maven.pkg.github.com",token:"def"},
118-
{type:"nuget_feed",host:"nuget.pkg.github.com",token:"ghi"},
119-
{type:"goproxy_server",host:"goproxy.example.com",token:"jkl"},
120-
];
121130
constcredentialsInput=toEncodedJSON(mixedCredentials);
122131

123132
constcredentials=startProxyExports.getCredentials(

‎src/start-proxy.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ const LANGUAGE_TO_REGISTRY_TYPE: Partial<Record<KnownLanguage, string[]>> = {
6262
python:["python_index"],
6363
ruby:["rubygems_server"],
6464
rust:["cargo_registry"],
65-
go:["goproxy_server"],
65+
go:["goproxy_server","git_source"],
6666
}asconst;
6767

6868
/**

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp