Skip to content

chore: add post commit script #96

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 9 commits into from
Apr 19, 2025
Merged

chore: add post commit script #96

merged 9 commits into from
Apr 19, 2025

Conversation

Groupguanfang
Copy link
Owner

No description provided.

@Copilot Copilot AI review requested due to automatic review settings April 19, 2025 06:17
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds a new post-commit script to automate changeset markdown creation after commits. Key changes include:

  • Implementing functions to obtain the last commit details (ID, message, and file list).
  • Parsing workspace packages from a YAML file and linking committed files to their respective workspace.
  • Composing and writing a changeset markdown file, then auto-committing the changes.
Files not reviewed (2)
  • package.json: Language not supported
  • pnpm-lock.yaml: Language not supported

const lastCommitMessage = await getLastCommitMessage()
const matchedChangeset = await getMatchedChangeset(lastCommitMessage)
if (!matchedChangeset)
return console.warn(`The commit message "${lastCommitMessage}" does not match any angular changeset type.`)
Copy link
Preview

Copilot AI Apr 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The warning message incorrectly refers to 'angular changeset type'. Consider updating it to reflect the general changeset logic used by the script.

Suggested change
return console.warn(`The commit message "${lastCommitMessage}" does not match any angular changeset type.`)
return console.warn(`The commit message "${lastCommitMessage}" does not match any recognized changeset type.`)

Copilot is powered by AI, so mistakes are possible. Review output carefully before use.


console.log(`${workspaceCommittedFiles.map(v => k.dim(`${k.green(`[${v.workspace ? '✓' : '✗'}]`)} ${path.relative(process.cwd(), v.filePath)}: detected workspace: ${v.workspace?.folderPath ? path.relative(process.cwd(), v.workspace.folderPath) : 'null'}`)).join('\n')}`)
if (workspaceCommittedFiles.every(v => v.workspace === null))
return console.warn(k.yellow(`The commit "${lastCommitMessage}" has not files in the workspace.`))
Copy link
Preview

Copilot AI Apr 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The warning message contains a grammatical error ('has not files'); consider changing it to 'has no files'.

Suggested change
return console.warn(k.yellow(`The commit "${lastCommitMessage}" has not files in the workspace.`))
return console.warn(k.yellow(`The commit "${lastCommitMessage}" has no files in the workspace.`))

Copilot is powered by AI, so mistakes are possible. Review output carefully before use.

@Groupguanfang Groupguanfang merged commit 7de7862 into v1 Apr 19, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants