1
1
mirror of https://github.com/orhun/git-cliff.git synced 2024-09-11 15:05:30 +03:00

Compare commits

...

3 Commits

Author SHA1 Message Date
dependabot[bot]
eab834e6f0
Merge c0cf1d7a06 into 4b33e7e986 2024-08-05 22:25:05 +00:00
dependabot[bot]
c0cf1d7a06
chore(deps): bump the patch group across 1 directory with 2 updates
Bumps the patch group with 2 updates in the /website directory: [@easyops-cn/docusaurus-search-local](https://github.com/easyops-cn/docusaurus-search-local/tree/HEAD/packages/docusaurus-search-local) and [typescript](https://github.com/Microsoft/TypeScript).


Updates `@easyops-cn/docusaurus-search-local` from 0.44.2 to 0.44.3
- [Release notes](https://github.com/easyops-cn/docusaurus-search-local/releases)
- [Commits](https://github.com/easyops-cn/docusaurus-search-local/commits/v0.44.3/packages/docusaurus-search-local)

Updates `typescript` from 5.5.2 to 5.5.3
- [Release notes](https://github.com/Microsoft/TypeScript/releases)
- [Changelog](https://github.com/microsoft/TypeScript/blob/main/azure-pipelines.release.yml)
- [Commits](https://github.com/Microsoft/TypeScript/compare/v5.5.2...v5.5.3)

---
updated-dependencies:
- dependency-name: "@easyops-cn/docusaurus-search-local"
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: patch
- dependency-name: typescript
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-08-05 22:25:02 +00:00
Orhun Parmaksız
4b33e7e986
feat(remote): activate integration if remote is set manually (#782) 2024-08-04 22:35:32 +03:00
7 changed files with 81 additions and 54 deletions

View File

@ -206,9 +206,9 @@ impl<'a> Changelog<'a> {
#[cfg(feature = "github")]
fn get_github_metadata(&self) -> Result<crate::remote::RemoteMetadata> {
use crate::remote::github;
if self
.body_template
.contains_variable(github::TEMPLATE_VARIABLES) ||
if self.config.remote.github.is_custom ||
self.body_template
.contains_variable(github::TEMPLATE_VARIABLES) ||
self.footer_template
.as_ref()
.map(|v| v.contains_variable(github::TEMPLATE_VARIABLES))
@ -262,9 +262,9 @@ impl<'a> Changelog<'a> {
#[cfg(feature = "gitlab")]
fn get_gitlab_metadata(&self) -> Result<crate::remote::RemoteMetadata> {
use crate::remote::gitlab;
if self
.body_template
.contains_variable(gitlab::TEMPLATE_VARIABLES) ||
if self.config.remote.gitlab.is_custom ||
self.body_template
.contains_variable(gitlab::TEMPLATE_VARIABLES) ||
self.footer_template
.as_ref()
.map(|v| v.contains_variable(gitlab::TEMPLATE_VARIABLES))
@ -326,9 +326,9 @@ impl<'a> Changelog<'a> {
#[cfg(feature = "gitea")]
fn get_gitea_metadata(&self) -> Result<crate::remote::RemoteMetadata> {
use crate::remote::gitea;
if self
.body_template
.contains_variable(gitea::TEMPLATE_VARIABLES) ||
if self.config.remote.gitea.is_custom ||
self.body_template
.contains_variable(gitea::TEMPLATE_VARIABLES) ||
self.footer_template
.as_ref()
.map(|v| v.contains_variable(gitea::TEMPLATE_VARIABLES))
@ -379,9 +379,9 @@ impl<'a> Changelog<'a> {
#[cfg(feature = "bitbucket")]
fn get_bitbucket_metadata(&self) -> Result<crate::remote::RemoteMetadata> {
use crate::remote::bitbucket;
if self
.body_template
.contains_variable(bitbucket::TEMPLATE_VARIABLES) ||
if self.config.remote.bitbucket.is_custom ||
self.body_template
.contains_variable(bitbucket::TEMPLATE_VARIABLES) ||
self.footer_template
.as_ref()
.map(|v| v.contains_variable(bitbucket::TEMPLATE_VARIABLES))
@ -791,24 +791,28 @@ mod test {
},
remote: RemoteConfig {
github: Remote {
owner: String::from("coolguy"),
repo: String::from("awesome"),
token: None,
owner: String::from("coolguy"),
repo: String::from("awesome"),
token: None,
is_custom: false,
},
gitlab: Remote {
owner: String::from("coolguy"),
repo: String::from("awesome"),
token: None,
owner: String::from("coolguy"),
repo: String::from("awesome"),
token: None,
is_custom: false,
},
gitea: Remote {
owner: String::from("coolguy"),
repo: String::from("awesome"),
token: None,
owner: String::from("coolguy"),
repo: String::from("awesome"),
token: None,
is_custom: false,
},
bitbucket: Remote {
owner: String::from("coolguy"),
repo: String::from("awesome"),
token: None,
owner: String::from("coolguy"),
repo: String::from("awesome"),
token: None,
is_custom: false,
},
},
bump: Bump::default(),

View File

@ -138,12 +138,20 @@ pub struct RemoteConfig {
#[derive(Debug, Default, Clone, Serialize, Deserialize)]
pub struct Remote {
/// Owner of the remote.
pub owner: String,
pub owner: String,
/// Repository name.
pub repo: String,
pub repo: String,
/// Access token.
#[serde(skip_serializing)]
pub token: Option<SecretString>,
pub token: Option<SecretString>,
/// Whether if the remote is set manually.
#[serde(skip_deserializing, default = "default_true")]
pub is_custom: bool,
}
/// Returns `true` for serde's `default` attribute.
fn default_true() -> bool {
true
}
impl fmt::Display for Remote {
@ -162,9 +170,10 @@ impl Remote {
/// Constructs a new instance.
pub fn new<S: Into<String>>(owner: S, repo: S) -> Self {
Self {
owner: owner.into(),
repo: repo.into(),
token: None,
owner: owner.into(),
repo: repo.into(),
token: None,
is_custom: false,
}
}

View File

@ -244,9 +244,10 @@ impl Repository {
(segments.get(1), segments.first())
{
return Ok(Remote {
owner: owner.to_string(),
repo: repo.trim_end_matches(".git").to_string(),
token: None,
owner: owner.to_string(),
repo: repo.trim_end_matches(".git").to_string(),
token: None,
is_custom: false,
});
}
}
@ -360,9 +361,10 @@ mod test {
let remote = repository.upstream_remote()?;
assert_eq!(
Remote {
owner: String::from("orhun"),
repo: String::from("git-cliff"),
token: None,
owner: String::from("orhun"),
repo: String::from("git-cliff"),
token: None,
is_custom: false,
},
remote
);

View File

@ -115,6 +115,7 @@ fn process_repository<'a>(
debug!("No GitHub remote is set, using remote: {}", remote);
config.remote.github.owner = remote.owner;
config.remote.github.repo = remote.repo;
config.remote.github.is_custom = remote.is_custom;
}
Err(e) => {
debug!("Failed to get remote from GitHub repository: {:?}", e);
@ -126,6 +127,7 @@ fn process_repository<'a>(
debug!("No GitLab remote is set, using remote: {}", remote);
config.remote.gitlab.owner = remote.owner;
config.remote.gitlab.repo = remote.repo;
config.remote.gitlab.is_custom = remote.is_custom;
}
Err(e) => {
debug!("Failed to get remote from GitLab repository: {:?}", e);
@ -137,6 +139,7 @@ fn process_repository<'a>(
debug!("No Gitea remote is set, using remote: {}", remote);
config.remote.gitea.owner = remote.owner;
config.remote.gitea.repo = remote.repo;
config.remote.gitea.is_custom = remote.is_custom;
}
Err(e) => {
debug!("Failed to get remote from Gitea repository: {:?}", e);
@ -148,6 +151,7 @@ fn process_repository<'a>(
debug!("No Bitbucket remote is set, using remote: {}", remote);
config.remote.bitbucket.owner = remote.owner;
config.remote.bitbucket.repo = remote.repo;
config.remote.bitbucket.is_custom = remote.is_custom;
}
Err(e) => {
debug!("Failed to get remote from Bitbucket repository: {:?}", e);
@ -465,14 +469,22 @@ pub fn run(mut args: Opt) -> Result<()> {
if let Some(ref remote) = args.github_repo {
config.remote.github.owner = remote.0.owner.to_string();
config.remote.github.repo = remote.0.repo.to_string();
config.remote.github.is_custom = true;
}
if let Some(ref remote) = args.gitlab_repo {
config.remote.gitlab.owner = remote.0.owner.to_string();
config.remote.gitlab.repo = remote.0.repo.to_string();
config.remote.gitlab.is_custom = true;
}
if let Some(ref remote) = args.bitbucket_repo {
config.remote.bitbucket.owner = remote.0.owner.to_string();
config.remote.bitbucket.repo = remote.0.repo.to_string();
config.remote.bitbucket.is_custom = true;
}
if let Some(ref remote) = args.gitea_repo {
config.remote.gitea.owner = remote.0.owner.to_string();
config.remote.gitea.repo = remote.0.repo.to_string();
config.remote.gitea.is_custom = true;
}
if args.no_exec {
if let Some(ref mut preprocessors) = config.git.commit_preprocessors {

View File

@ -11,7 +11,7 @@
"dependencies": {
"@docusaurus/core": "^3.4.0",
"@docusaurus/preset-classic": "^3.4.0",
"@easyops-cn/docusaurus-search-local": "^0.44.2",
"@easyops-cn/docusaurus-search-local": "^0.44.4",
"@mdx-js/react": "^3.0.1",
"clsx": "^2.1.1",
"prism-react-renderer": "^2.3.0",
@ -21,7 +21,7 @@
"devDependencies": {
"@docusaurus/module-type-aliases": "^3.4.0",
"@docusaurus/tsconfig": "^3.4.0",
"typescript": "^5.5.2"
"typescript": "^5.5.4"
},
"engines": {
"node": ">=18.0"
@ -2738,9 +2738,9 @@
}
},
"node_modules/@easyops-cn/docusaurus-search-local": {
"version": "0.44.2",
"resolved": "https://registry.npmjs.org/@easyops-cn/docusaurus-search-local/-/docusaurus-search-local-0.44.2.tgz",
"integrity": "sha512-4tMBU54R1O6ITxkMGwOEifSHNkZLa2fb4ajGc8rd6TYZ0a8+jlu/u/5gYtw1s6sGGMRkwyG+QI6HD0bEnCRa1w==",
"version": "0.44.4",
"resolved": "https://registry.npmjs.org/@easyops-cn/docusaurus-search-local/-/docusaurus-search-local-0.44.4.tgz",
"integrity": "sha512-Zgp69N9W+lkOqmwxE3aLLkveeqSJh/BwHg6TFZTfbliwEg9p9k5DH8NBWfZNpVfN7y6RFqCQ6/SU2l+4hKcXzw==",
"dependencies": {
"@docusaurus/plugin-content-docs": "^2 || ^3",
"@docusaurus/theme-translations": "^2 || ^3",
@ -13885,9 +13885,9 @@
}
},
"node_modules/typescript": {
"version": "5.5.2",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.5.2.tgz",
"integrity": "sha512-NcRtPEOsPFFWjobJEtfihkLCZCXZt/os3zf8nTxjVH3RvTSxjrCamJpbExGvYOF+tFHc3pA65qpdwPbzjohhew==",
"version": "5.5.4",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.5.4.tgz",
"integrity": "sha512-Mtq29sKDAEYP7aljRgtPOpTvOfbwRWlS6dPRzwjdE+C0R4brX/GUyhHSecbHMFLNBLcJIPt9nl9yG5TZ1weH+Q==",
"bin": {
"tsc": "bin/tsc",
"tsserver": "bin/tsserver"

View File

@ -18,7 +18,7 @@
"dependencies": {
"@docusaurus/core": "^3.4.0",
"@docusaurus/preset-classic": "^3.4.0",
"@easyops-cn/docusaurus-search-local": "^0.44.2",
"@easyops-cn/docusaurus-search-local": "^0.44.4",
"@mdx-js/react": "^3.0.1",
"clsx": "^2.1.1",
"prism-react-renderer": "^2.3.0",
@ -28,7 +28,7 @@
"devDependencies": {
"@docusaurus/module-type-aliases": "^3.4.0",
"@docusaurus/tsconfig": "^3.4.0",
"typescript": "^5.5.2"
"typescript": "^5.5.4"
},
"browserslist": {
"production": [

View File

@ -1671,10 +1671,10 @@
cssesc "^3.0.0"
immediate "^3.2.3"
"@easyops-cn/docusaurus-search-local@^0.44.2":
version "0.44.2"
resolved "https://registry.yarnpkg.com/@easyops-cn/docusaurus-search-local/-/docusaurus-search-local-0.44.2.tgz#580925d8b94220cecbe30c466bdc0b32cb275cf6"
integrity sha512-4tMBU54R1O6ITxkMGwOEifSHNkZLa2fb4ajGc8rd6TYZ0a8+jlu/u/5gYtw1s6sGGMRkwyG+QI6HD0bEnCRa1w==
"@easyops-cn/docusaurus-search-local@^0.44.4":
version "0.44.4"
resolved "https://registry.yarnpkg.com/@easyops-cn/docusaurus-search-local/-/docusaurus-search-local-0.44.4.tgz#d02122c3966eb6ab0bf152c07d7741015fb1c297"
integrity sha512-Zgp69N9W+lkOqmwxE3aLLkveeqSJh/BwHg6TFZTfbliwEg9p9k5DH8NBWfZNpVfN7y6RFqCQ6/SU2l+4hKcXzw==
dependencies:
"@docusaurus/plugin-content-docs" "^2 || ^3"
"@docusaurus/theme-translations" "^2 || ^3"
@ -8085,10 +8085,10 @@ typedarray-to-buffer@^3.1.5:
dependencies:
is-typedarray "^1.0.0"
typescript@^5.5.2:
version "5.5.2"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.5.2.tgz#c26f023cb0054e657ce04f72583ea2d85f8d0507"
integrity sha512-NcRtPEOsPFFWjobJEtfihkLCZCXZt/os3zf8nTxjVH3RvTSxjrCamJpbExGvYOF+tFHc3pA65qpdwPbzjohhew==
typescript@^5.5.4:
version "5.5.4"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.5.4.tgz#d9852d6c82bad2d2eda4fd74a5762a8f5909e9ba"
integrity sha512-Mtq29sKDAEYP7aljRgtPOpTvOfbwRWlS6dPRzwjdE+C0R4brX/GUyhHSecbHMFLNBLcJIPt9nl9yG5TZ1weH+Q==
undici-types@~5.26.4:
version "5.26.5"