-
Notifications
You must be signed in to change notification settings - Fork 0
feat: add marketplace icon #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| # Marketplace icon notice | ||
|
|
||
| `icon.svg` uses GitHub's official black Invertocat with its supplied clear | ||
| space. The mark is taken from GitHub's current logo package: | ||
|
|
||
| - Source: <https://brand.github.com/foundations/logo> | ||
| - Package: <https://brand.github.com/GitHub_Logos.zip> | ||
| - Package member: `GitHub Logos/SVG/GitHub_Invertocat_Black_Clearspace.svg` | ||
| - Retrieved: 2026-08-17 | ||
|
|
||
| The Invertocat path, dimensions, and clear space are unchanged. A plain white | ||
| presentation field is placed behind the black mark to retain the contrast | ||
| GitHub requires in both light and dark Kandev themes. The packaged SVG's | ||
| SHA-256 is `500cc7f291e1e2dd734539a44f70259f809f18dbcab6e4d208012725967c6878`. | ||
|
|
||
| GITHUB, the GITHUB logo design, INVERTOCAT, OCTOCAT, and the OCTOCAT logo design | ||
| are trademarks of GitHub, Inc. The mark remains GitHub property and is used | ||
| here only to identify the service this plugin integrates with. This plugin is | ||
| not sponsored by or endorsed by GitHub. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| package main | ||
|
|
||
| import ( | ||
| "crypto/sha256" | ||
| "encoding/xml" | ||
| "fmt" | ||
| "os" | ||
| "path/filepath" | ||
| "strings" | ||
| "testing" | ||
| ) | ||
|
|
||
| const approvedMarketplaceIconSHA256 = "500cc7f291e1e2dd734539a44f70259f809f18dbcab6e4d208012725967c6878" | ||
|
|
||
| func TestManifestIncludesPackagedMarketplaceIcon(t *testing.T) { | ||
| contents, err := os.ReadFile("../manifest.yaml") | ||
| if err != nil { | ||
| t.Fatal(err) | ||
| } | ||
|
|
||
| iconPath := manifestIconPath(string(contents)) | ||
| if iconPath != "assets/icon.svg" { | ||
| t.Fatalf("manifest icon = %q, want %q", iconPath, "assets/icon.svg") | ||
| } | ||
|
|
||
| icon, err := os.ReadFile(filepath.Join("..", filepath.FromSlash(iconPath))) | ||
| if err != nil { | ||
| t.Fatal(err) | ||
| } | ||
| assertMarketplaceSVG(t, icon) | ||
| } | ||
|
|
||
| func manifestIconPath(manifest string) string { | ||
| for _, line := range strings.Split(manifest, "\n") { | ||
| if strings.HasPrefix(line, "icon:") { | ||
| return strings.Trim(strings.TrimSpace(strings.TrimPrefix(line, "icon:")), `"`) | ||
| } | ||
| } | ||
| return "" | ||
| } | ||
|
|
||
| func assertMarketplaceSVG(t *testing.T, icon []byte) { | ||
| t.Helper() | ||
| if got := fmt.Sprintf("%x", sha256.Sum256(icon)); got != approvedMarketplaceIconSHA256 { | ||
| t.Fatalf("marketplace SVG sha256 = %q, want approved GitHub asset %q", got, approvedMarketplaceIconSHA256) | ||
| } | ||
|
|
||
| var root struct { | ||
| XMLName xml.Name | ||
| Width string `xml:"width,attr"` | ||
| Height string `xml:"height,attr"` | ||
| ViewBox string `xml:"viewBox,attr"` | ||
| } | ||
| if err := xml.Unmarshal(icon, &root); err != nil { | ||
| t.Fatal(err) | ||
| } | ||
| if root.XMLName.Local != "svg" || root.Width != "128" || root.Height != "128" || root.ViewBox != "0 0 128 128" { | ||
| t.Fatalf("unexpected SVG root: name=%q width=%q height=%q viewBox=%q", root.XMLName.Local, root.Width, root.Height, root.ViewBox) | ||
| } | ||
|
|
||
| lower := strings.ToLower(string(icon)) | ||
| for _, forbidden := range []string{"<script", "<foreignobject", "href=", "url(", "currentcolor"} { | ||
| if strings.Contains(lower, forbidden) { | ||
| t.Fatalf("marketplace SVG contains forbidden content %q", forbidden) | ||
| } | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.