Skip to content

Commit

Permalink
Fix for pipeline names with characters that need to be encoded.
Browse files Browse the repository at this point in the history
  • Loading branch information
erikdoe committed Aug 28, 2023
1 parent 6e38172 commit 1939516
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
4 changes: 2 additions & 2 deletions CCMenu/Resources/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<key>CFBundlePackageType</key>
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
<key>CFBundleShortVersionString</key>
<string>20.0</string>
<string>20.1</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
Expand All @@ -34,7 +34,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>2200.3</string>
<string>2201.3</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.developer-tools</string>
<key>LSMinimumSystemVersion</key>
Expand Down
6 changes: 5 additions & 1 deletion CCMenu/Source/Pipeline Window/AddGithubPipeline.swift
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,11 @@ struct AddGithubPipelineSheet: View {


private func updatePipeline() {
pipeline.feed.url = String(format: "https://api.github.com/repos/%@/%@/actions/workflows/%@/runs", owner, repository, workflow)
var components = URLComponents()
components.scheme = "https"
components.host = "api.github.com"
components.path = String(format: "/repos/%@/%@/actions/workflows/%@/runs", owner, repository, workflow)
pipeline.feed.url = components.url!.absoluteString
pipeline.name = "\(repository) (\(workflow))"
}

Expand Down
7 changes: 6 additions & 1 deletion CCMenu/Source/Server Monitor/GithubFeedReader.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,12 @@ class GithubFeedReader: NSObject, FeedReader {

public func updatePipelineStatus() {
// TODO: consider making page size configurable to make sure to get a completed/successful
var request = URLRequest(url: URL(string: pipeline.feed.url + "?per_page=5")!)
guard let url = URL(string: pipeline.feed.url + "?per_page=5") else {
pipeline.connectionError = "Invalid URL: " + pipeline.feed.url
delegate?.feedReader(self, didUpdate: pipeline)
return
}
var request = URLRequest(url: url)
if let token = pipeline.feed.authToken {
request.setValue("Bearer \(token)", forHTTPHeaderField: "Authorization")
}
Expand Down

0 comments on commit 1939516

Please sign in to comment.