Skip to content
Open
Show file tree
Hide file tree
Changes from 31 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
d8e6bc2
refactor: introduce scm abstraction
chingor13 Apr 3, 2026
131ccb9
feat(local-github): maintain temporary clone
chingor13 Apr 3, 2026
68f0602
feat(local-github): read files from local clone
chingor13 Apr 3, 2026
1bdf717
feat(local-github): find files by filename
chingor13 Apr 3, 2026
4f3f3e2
feat(local-github): find files by glob
chingor13 Apr 3, 2026
36cd502
feat(local-github): find files by extension
chingor13 Apr 3, 2026
5d172ea
feat(local-github): merge commit iterator
chingor13 Apr 3, 2026
f1c5192
refactor: common GitHub API tasks to delegate
chingor13 Apr 3, 2026
dbffbe3
feat(local-github): tag iterator
chingor13 Apr 3, 2026
e2fd590
feat(local-github): githubApiDelegate is required
chingor13 Apr 3, 2026
97ec586
chore: fix lint
chingor13 Apr 3, 2026
e860401
feat(cli): allow --local arg
chingor13 Apr 3, 2026
73a508d
feat(local-github): add logger
chingor13 Apr 3, 2026
4442475
fix(local-github): clone once during setup
chingor13 Apr 3, 2026
3819534
feat(local-github): support existing local clone
chingor13 Apr 3, 2026
150af21
feat(local-github): add --local-path CLI arg
chingor13 Apr 3, 2026
3accc78
refactor(local-github): git commands as stream
chingor13 Apr 3, 2026
0f3f1fb
fix: maxBuffer size and tree path
chingor13 Apr 3, 2026
9aef06f
fix: apply commits locally
chingor13 Apr 3, 2026
bc09783
test: fix snapshot
chingor13 Apr 3, 2026
8e50b15
fix: commit message file should not be committed
chingor13 Apr 3, 2026
e28b1b8
fix(local-github): update pull request directly uses API
chingor13 Apr 3, 2026
528552b
refactor: rename to GitHubApi
chingor13 Apr 8, 2026
4adfb49
refactor: move create options to GitHubApi
chingor13 Apr 8, 2026
a276678
refactor: move code-suggester code update logic to github class
chingor13 Apr 8, 2026
7d4fe01
feat!: remove unused createReleaasePullRequest method
chingor13 Apr 8, 2026
52e4f42
test: add local github tests
chingor13 Apr 8, 2026
c4e043e
fix: can read files from local clone on a different branch
chingor13 Apr 8, 2026
49b1602
test: ensure we can read files from a tag
chingor13 Apr 8, 2026
4cd1242
fix: fix finding files in other branches
chingor13 Apr 8, 2026
3fd9bdf
cleanup: add doc strings and removed unused functions
chingor13 Apr 8, 2026
d04eb70
chore: remove unused attribute
chingor13 Apr 8, 2026
0ff3d41
fix: use execFile
chingor13 Apr 8, 2026
408a741
fix: second order command injection
chingor13 Apr 8, 2026
c4bfff9
fix: clone repo if provided path is not a git clone
chingor13 Apr 8, 2026
988389b
feat(cli): add --local-clone-depth option
chingor13 Apr 8, 2026
d464e48
Merge branch 'main' into local-github-scm
chingor13 Apr 8, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions __snapshots__/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ Options:
--repo-url GitHub URL to generate release for [required]
--dry-run Prepare but do not take action
[boolean] [default: false]
--local Whether to use local clone
[boolean] [default: false]
--local-path Path to existing local clone [string]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Maybe examples of how to use them?
For example, if --local is true, are --local-path and --local-clone-depth required? Or there are default values for them?

--include-v-in-tags include "v" in tag versions
[boolean] [default: true]
--monorepo-tags include library name in tags and release
Expand Down Expand Up @@ -97,6 +100,8 @@ Options:
on [string]
--repo-url GitHub URL to generate release for [required]
--dry-run Prepare but do not take action[boolean] [default: false]
--local Whether to use local clone [boolean] [default: false]
--local-path Path to existing local clone [string]
--label comma-separated list of labels to add to from release PR
[default: "autorelease: pending"]
--skip-labeling skip application of labels to pull requests
Expand Down Expand Up @@ -138,6 +143,8 @@ Options:
on [string]
--repo-url GitHub URL to generate release for [required]
--dry-run Prepare but do not take action[boolean] [default: false]
--local Whether to use local clone [boolean] [default: false]
--local-path Path to existing local clone [string]
--draft mark release as a draft. no tag is created but tag_name
and target_commitish are associated with the release for
future tag creation upon "un-drafting" the release.
Expand Down Expand Up @@ -187,6 +194,9 @@ Options:
--repo-url GitHub URL to generate release for[required]
--dry-run Prepare but do not take action
[boolean] [default: false]
--local Whether to use local clone
[boolean] [default: false]
--local-path Path to existing local clone [string]
--release-as override the semantically determined release
version [string]
--bump-minor-pre-major should we bump the semver minor prior to the
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"main": "./build/src/index.js",
"bin": "./build/src/bin/release-please.js",
"scripts": {
"test": "cross-env ENVIRONMENT=test LC_ALL=en c8 mocha --node-option no-experimental-fetch --recursive --timeout=5000 build/test",
"test": "cross-env ENVIRONMENT=test LC_ALL=en c8 mocha --recursive --timeout=5000 build/test",
"docs": "echo add docs tests",
"test:snap": "cross-env SNAPSHOT_UPDATE=1 LC_ALL=en npm test",
"clean": "gts clean",
Expand Down
46 changes: 36 additions & 10 deletions src/bin/release-please.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@

import {coerceOption} from '../util/coerce-option';
import * as yargs from 'yargs';
import {GitHub, GH_API_URL, GH_GRAPHQL_URL} from '../github';
import {GitHub} from '../github';
import {GH_API_URL, GH_GRAPHQL_URL} from '../github-api';
import {Manifest, ManifestOptions, ROOT_PROJECT_PATH} from '../manifest';
import {ChangelogSection, buildChangelogSections} from '../changelog-notes';
import {logger, setLogger, CheckpointLogger} from '../util/logger';
Expand All @@ -30,6 +31,8 @@ import {
} from '../factory';
import {Bootstrapper} from '../bootstrapper';
import {createPatch} from 'diff';
import {Scm} from '../scm';
import {LocalGitHub} from '../local-github';

// eslint-disable-next-line @typescript-eslint/no-var-requires
const parseGithubRepoUrl = require('parse-github-repo-url');
Expand All @@ -49,6 +52,8 @@ interface GitHubArgs {
apiUrl?: string;
graphqlUrl?: string;
fork?: boolean;
local?: boolean;
localPath?: string;

// deprecated in favor of targetBranch
defaultBranch?: string;
Expand Down Expand Up @@ -187,6 +192,15 @@ function gitHubOptions(yargs: yargs.Argv): yargs.Argv {
type: 'boolean',
default: false,
})
.option('local', {
describe: 'Whether to use local clone',
type: 'boolean',
default: false,
})
.option('local-path', {
describe: 'Path to existing local clone',
type: 'string',
})
.middleware(_argv => {
const argv = _argv as GitHubArgs;
// allow secrets to be loaded from file path
Expand Down Expand Up @@ -817,16 +831,28 @@ const debugConfigCommand: yargs.CommandModule<{}, DebugConfigArgs> = {
},
};

async function buildGitHub(argv: GitHubArgs): Promise<GitHub> {
async function buildGitHub(argv: GitHubArgs): Promise<Scm> {
const [owner, repo] = parseGithubRepoUrl(argv.repoUrl);
const github = await GitHub.create({
owner,
repo,
token: argv.token!,
apiUrl: argv.apiUrl,
graphqlUrl: argv.graphqlUrl,
});
return github;
if (argv.local) {
const localGitHub = await LocalGitHub.create({
owner,
repo,
token: argv.token!,
apiUrl: argv.apiUrl,
graphqlUrl: argv.graphqlUrl,
localRepoPath: argv.localPath,
});
return localGitHub;
} else {
const github = await GitHub.create({
owner,
repo,
token: argv.token!,
apiUrl: argv.apiUrl,
graphqlUrl: argv.graphqlUrl,
});
return github;
}
}

export const parser = yargs
Expand Down
6 changes: 3 additions & 3 deletions src/bootstrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

import {GitHub} from './github';
import {Scm} from './scm';
import {
DEFAULT_RELEASE_PLEASE_MANIFEST,
DEFAULT_RELEASE_PLEASE_CONFIG,
Expand All @@ -30,13 +30,13 @@ interface BootstrapPullRequest extends PullRequest {
}

export class Bootstrapper {
private github: GitHub;
private github: Scm;
private targetBranch: string;
private manifestFile: string;
private configFile: string;
private initialVersion: Version;
constructor(
github: GitHub,
github: Scm,
targetBranch: string,
manifestFile: string = DEFAULT_RELEASE_PLEASE_MANIFEST,
configFile: string = DEFAULT_RELEASE_PLEASE_CONFIG,
Expand Down
6 changes: 3 additions & 3 deletions src/changelog-notes/github.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@

import {ChangelogNotes, BuildNotesOptions} from '../changelog-notes';
import {ConventionalCommit} from '../commit';
import {GitHub} from '../github';
import {Scm} from '../scm';

export class GitHubChangelogNotes implements ChangelogNotes {
private github: GitHub;
constructor(github: GitHub) {
private github: Scm;
constructor(github: Scm) {
this.github = github;
}
async buildNotes(
Expand Down
4 changes: 2 additions & 2 deletions src/factories/changelog-notes-factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

import {GitHub} from '../github';
import {Scm} from '../scm';
import {ChangelogNotes, ChangelogSection} from '../changelog-notes';
import {GitHubChangelogNotes} from '../changelog-notes/github';
import {DefaultChangelogNotes} from '../changelog-notes/default';
Expand All @@ -22,7 +22,7 @@ export type ChangelogNotesType = string;

export interface ChangelogNotesFactoryOptions {
type: ChangelogNotesType;
github: GitHub;
github: Scm;
changelogSections?: ChangelogSection[];
commitPartial?: string;
headerPartial?: string;
Expand Down
4 changes: 2 additions & 2 deletions src/factories/plugin-factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {
SentenceCasePluginConfig,
GroupPriorityPluginConfig,
} from '../manifest';
import {GitHub} from '../github';
import {Scm} from '../scm';
import {ManifestPlugin} from '../plugin';
import {LinkedVersions} from '../plugins/linked-versions';
import {CargoWorkspace} from '../plugins/cargo-workspace';
Expand All @@ -34,7 +34,7 @@ import {WorkspacePluginOptions} from '../plugins/workspace';

export interface PluginFactoryOptions {
type: PluginType;
github: GitHub;
github: Scm;
targetBranch: string;
repositoryConfig: RepositoryConfig;
manifestPath: string;
Expand Down
4 changes: 2 additions & 2 deletions src/factories/versioning-strategy-factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {AlwaysBumpPatch} from '../versioning-strategies/always-bump-patch';
import {AlwaysBumpMinor} from '../versioning-strategies/always-bump-minor';
import {AlwaysBumpMajor} from '../versioning-strategies/always-bump-major';
import {ServicePackVersioningStrategy} from '../versioning-strategies/service-pack';
import {GitHub} from '../github';
import {Scm} from '../scm';
import {ConfigurationError} from '../errors';
import {PrereleaseVersioningStrategy} from '../versioning-strategies/prerelease';

Expand All @@ -30,7 +30,7 @@ export interface VersioningStrategyFactoryOptions {
bumpPatchForMinorPreMajor?: boolean;
prereleaseType?: string;
prerelease?: boolean;
github: GitHub;
github: Scm;
}

export type VersioningStrategyBuilder = (
Expand Down
4 changes: 2 additions & 2 deletions src/factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import {ConfigurationError} from './errors';
import {buildChangelogNotes} from './factories/changelog-notes-factory';
import {buildVersioningStrategy} from './factories/versioning-strategy-factory';
import {GitHub} from './github';
import {Scm} from './scm';
import {ReleaserConfig} from './manifest';
import {BaseStrategyOptions} from './strategies/base';
import {Bazel} from './strategies/bazel';
Expand Down Expand Up @@ -61,7 +61,7 @@ export type ReleaseType = string;
export type ReleaseBuilder = (options: BaseStrategyOptions) => Strategy;

export interface StrategyFactoryOptions extends ReleaserConfig {
github: GitHub;
github: Scm;
path?: string;
targetBranch?: string;
}
Expand Down
Loading
Loading