Skip to content

Commit a53ab7c

Browse files
Updated script
1 parent ecdc400 commit a53ab7c

File tree

1 file changed

+19
-13
lines changed

1 file changed

+19
-13
lines changed

Script/on_merge.swift

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ let submissionsDirectoryName = "Submission"
1919
let template = #"""
2020
Name:
2121
Status:
22+
ProjectTitle:
2223
Technologies:
2324
2425
AboutMeUrl:
@@ -29,6 +30,7 @@ VideoUrl:
2930
EXAMPLE
3031
Name: John Appleseed
3132
Status: Submitted <or> Winner <or> Distinguished <or> Rejected
33+
ProjectTitle: The Accessibility Rose
3234
Technologies: SwiftUI, RealityKit, CoreGraphic
3335
3436
AboutMeUrl: https://linkedin.com/in/johnappleseed
@@ -55,13 +57,14 @@ var validatedTemplates = [(originalFilename: String, newFilename: String, conten
5557
for potentialTemplate in potentialTemplates {
5658
let lines = potentialTemplate.content.split(separator: "\n")
5759

58-
guard lines.count >= 6 else { continue }
60+
guard lines.count >= 7 else { continue }
5961
guard lines[0].hasPrefix("Name:") else { continue }
6062
guard lines[1].hasPrefix("Status:") else { continue }
61-
guard lines[2].hasPrefix("Technologies:") else { continue }
62-
guard lines[3].hasPrefix("AboutMeUrl:") else { continue }
63-
guard lines[4].hasPrefix("SourceUrl:") else { continue }
64-
guard lines[5].hasPrefix("VideoUrl:") else { continue }
63+
guard lines[2].hasPrefix("ProjectTitle:") else { continue }
64+
guard lines[3].hasPrefix("Technologies:") else { continue }
65+
guard lines[4].hasPrefix("AboutMeUrl:") else { continue }
66+
guard lines[5].hasPrefix("SourceUrl:") else { continue }
67+
guard lines[6].hasPrefix("VideoUrl:") else { continue }
6568

6669
let newFilename = lines[0]
6770
.replacingOccurrences(of: "Name:", with: "")
@@ -105,6 +108,7 @@ try? template.write(toFile: "Template.md", atomically: true, encoding: .utf8)
105108
struct Submission {
106109
let name: String
107110
let status: Status
111+
let projectTitle: String?
108112
let technologies: [String]
109113

110114
let aboutMeUrl: URL?
@@ -204,19 +208,24 @@ for submissionFile in submissionFiles {
204208
)
205209
} else { nil }
206210

207-
let technologies: [String] = if lines[2].hasPrefix("Technologies:"), let value = toValue(lines[2], key: "Technologies:") {
211+
212+
let projectTitle: String? = if lines[2].hasPrefix("ProjectTitle:") {
213+
toValue(lines[2], key: "ProjectTitle:")
214+
} else { nil }
215+
216+
let technologies: [String] = if lines[3].hasPrefix("Technologies:"), let value = toValue(lines[3], key: "Technologies:") {
208217
value.split(separator: ", ").map { String($0) }
209218
} else { [] }
210219

211-
let aboutMeUrl: URL? = if lines[3].hasPrefix("AboutMeUrl:"), let value = toValue(lines[3], key: "AboutMeUrl:"), let url = URL(string: value), url.isValid {
220+
let aboutMeUrl: URL? = if lines[4].hasPrefix("AboutMeUrl:"), let value = toValue(lines[4], key: "AboutMeUrl:"), let url = URL(string: value), url.isValid {
212221
url
213222
} else { nil }
214223

215-
let sourceUrl: URL? = if lines[4].hasPrefix("SourceUrl:") , let value = toValue(lines[4], key: "SourceUrl:"), let url = URL(string: value), url.isValid {
224+
let sourceUrl: URL? = if lines[5].hasPrefix("SourceUrl:") , let value = toValue(lines[5], key: "SourceUrl:"), let url = URL(string: value), url.isValid {
216225
url
217226
} else { nil }
218227

219-
let videoUrl: URL? = if lines[5].hasPrefix("VideoUrl:"), let value = toValue(lines[5], key: "VideoUrl:"), let url = URL(string: value), url.isValid {
228+
let videoUrl: URL? = if lines[6].hasPrefix("VideoUrl:"), let value = toValue(lines[6], key: "VideoUrl:"), let url = URL(string: value), url.isValid {
220229
url
221230
} else { nil }
222231

@@ -225,6 +234,7 @@ for submissionFile in submissionFiles {
225234
.init(
226235
name: name,
227236
status: status ?? .unknown,
237+
projectTitle: projectTitle,
228238
technologies: technologies,
229239
aboutMeUrl: aboutMeUrl,
230240
sourceUrl: sourceUrl,
@@ -233,10 +243,6 @@ for submissionFile in submissionFiles {
233243
)
234244
}
235245

236-
//AboutMeUrl
237-
//SourceUrl
238-
//VideoUrl
239-
240246
// MARK: - Generate new README.md file from template
241247
var readmeFile: String {
242248
"""

0 commit comments

Comments
 (0)