Skip to content

Commit

Permalink
feat: update script and log/exclude paths in git-release-notes genera…
Browse files Browse the repository at this point in the history
…tion
  • Loading branch information
pelikhan committed Oct 24, 2024
1 parent f5a2233 commit c3a14ab
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 23 deletions.
4 changes: 2 additions & 2 deletions packages/core/src/git.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,9 @@ export class GitClient implements Git {
args: string[]
) {
if (paths.length > 0 || excludedPaths.length > 0) {
if (!paths.length) paths.push(".")
args.push("--")
args.push(...paths)
if (!paths.length) args.push(".")
else args.push(...paths)
args.push(
...excludedPaths.map((p) => (p.startsWith(":!") ? p : ":!" + p))
)
Expand Down
53 changes: 32 additions & 21 deletions packages/sample/genaisrc/git-release-notes.genai.mjs
Original file line number Diff line number Diff line change
@@ -1,35 +1,46 @@
script({ system: ["system"], temperature: 0.5 })
script({
system: ["system"],
temperature: 0.5,
})

const product = env.vars.product || "GenAIScript"

// find previous tag
const { version } = await workspace.readJSON("package.json")
const tag = await git.lastTag()
const commits = await git.log({
excludedGrep: "(skip ci|THIRD_PARTY_NOTICES|genai)",
base: tag,
head: "HEAD",
})
const excludedPaths = [
"package.json",
"**/package.json",
"yarn.lock",
"**/yarn.lock",
"**/genaiscript.d.ts",
"**/jsconfig.json",
"docs/**",
".github/*",
".vscode/*",
"slides/**",
"THIRD_PARTY_LICENSES.md",
]
const commits = (
await git.log({
excludedGrep:
"(skip ci|THIRD_PARTY_NOTICES|THIRD_PARTY_LICENSES|genai)",
base: tag,
head: "HEAD",
excludedPaths,
})
)
.map(({ message }) => message)
.join("\n")
console.debug(commits)
const diff = await git.diff({
base: tag,
head: "HEAD",
excludedPaths: [
"**/package.json",
"**/genaiscript.d.ts",
"**/jsconfig.json",
"docs/**",
".github/*",
".vscode/*",
"**/yarn.lock",
"THIRD_PARTY_NOTICES.md",
],
excludedPaths,
})
console.debug(diff)

const commitsName = def(
"COMMITS",
commits.map(({ message }) => message).join("\n"),
{ maxTokens: 3000 }
)
const commitsName = def("COMMITS", commits, { maxTokens: 3000 })
const diffName = def("DIFF", diff, { maxTokens: 12000 })

$`
Expand Down

0 comments on commit c3a14ab

Please sign in to comment.