Skip to content

librarian: doc needs update for commit flag #2495

@zhumin8

Description

@zhumin8

Documentation does not mention of "commit" flag for generate.
And comment for the flag only mentions release:

func addFlagCommit(fs *flag.FlagSet, cfg *config.Config) {
fs.BoolVar(&cfg.Commit, "commit", false,
`If true, librarian will create a commit for the release but not create
a pull request. This flag is ignored if push is set to true.`)
}

Whereas push description includes both commit and push:
func addFlagPush(fs *flag.FlagSet, cfg *config.Config) {
fs.BoolVar(&cfg.Push, "push", false,
fmt.Sprintf(`If true, Librarian will create a commit and a pull request for the changes.
A GitHub token with push access must be provided via the
%s environment variable.`, config.LibrarianGithubToken))
}

But code honors a commit flag and will not commit if not provided.

commitInfo := &commitInfo{
branch: r.branch,
commit: r.commit,
commitMessage: "feat: generate libraries",
failedLibraries: failedLibraries,
ghClient: r.ghClient,
idToCommits: idToCommits,
prType: generate,
push: r.push,
repo: r.repo,
sourceRepo: r.sourceRepo,
state: r.state,
workRoot: r.workRoot,
failedGenerations: failedGenerations,
}
return commitAndPush(ctx, commitInfo)

func commitAndPush(ctx context.Context, info *commitInfo) error {
if !info.push && !info.commit {
slog.Info("Push flag and Commit flag are not specified, skipping committing")

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions