mirror of
https://github.com/changesets/action
synced 2026-10-26 16:39:56 +08:00
Comment changeset status in PRs (#625)
* Initial implementation * Fix * fix * fix * Make it look nicer * Update docs * Rename to pr-status-comment * Remove outputs * Update path * update name * Checkout PR in a detached worktree (#626) Co-authored-by: bluwy <bjornlu.dev@gmail.com> * Move comment to separate job * Loosen event requirement * Update * Apply suggestions from code review Co-authored-by: Mateusz Burzyński <mateuszburzynski@gmail.com> * Use TLA * use using * Remove test log --------- Co-authored-by: Mateusz Burzyński <mateuszburzynski@gmail.com>
This commit is contained in:
co-authored by
Mateusz Burzyński
parent
34f64f6e2e
commit
8795eee5ee
@@ -0,0 +1,30 @@
|
||||
import { getChangedPackagesSinceRef } from "@changesets/git";
|
||||
import { humanId } from "human-id";
|
||||
|
||||
export function getNewChangesetUrl(
|
||||
headRepoUrl: string,
|
||||
headRef: string,
|
||||
templateContent: string,
|
||||
) {
|
||||
const fileName = humanId({ separator: "-", capitalize: false });
|
||||
return `${headRepoUrl}/new/${headRef}?filename=.changeset/${fileName}.md&value=${encodeURIComponent(templateContent)}`;
|
||||
}
|
||||
|
||||
export async function getNewChangesetTemplateContent(
|
||||
cwd: string,
|
||||
baseRef: string,
|
||||
prTitle: string,
|
||||
) {
|
||||
const changedPackages = await getChangedPackagesSinceRef({
|
||||
cwd,
|
||||
ref: baseRef,
|
||||
});
|
||||
|
||||
return `\
|
||||
---
|
||||
${changedPackages.map((p) => `"${p.packageJson.name}": patch`).join("\n")}
|
||||
---
|
||||
|
||||
${prTitle}
|
||||
`;
|
||||
}
|
||||
Reference in New Issue
Block a user