Skip to content
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

feat(validation): add option to exclude a list of commits by sha #259

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
95 changes: 94 additions & 1 deletion dist/bump/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions dist/cli/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

95 changes: 94 additions & 1 deletion dist/validate/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ initial-development: false # OPTIONAL, defaults to `true`
| `allowed-branches` | `.*` | A regex specifying from which branch(es) releases and Git tags are allowed to be created |
| `initial-development` | `true` | A boolean indicating that this project is still under _initial development_. During this state, any commit message containing a breaking change will result in a `MINOR` version bump. |
| `sdkver-create-release-branches` | `false` | For SdkVer versioning scheme only: push a new branch if an RC or release build is performed on a non-release branch. If this config value is boolean `true`, the branch shall be of the form `release/N.N`. If this value is set to a string, it shall be used as the branch name prefix and appended with the major and minor release numbers, e.g. config value `"rel/"` results in a branch named `rel/N.N`. |
| `excluded-commits` | `[]` | An optional list of (40-character) SHA1 hashes representing commits (and their ancestry) that should not be checked. For example, when merging another repo/branch with non-conventional-commits, add the SHA of that repo/branch's HEAD to the list, which allows it to pass the validation action. |

> :bulb: By default `commisery-action` will search for the file `.commisery.yml`.
You can specify a different file with the `config` input parameter.
21 changes: 21 additions & 0 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ const CONFIG_ITEMS = [
"release-branches",
"prereleases",
"sdkver-create-release-branches",
"excluded-commits",
];

const VERSION_SCHEMES = ["semver", "sdkver"];
Expand Down Expand Up @@ -107,6 +108,7 @@ export class Configuration {
tags: IConfigurationRules = DEFAULT_ACCEPTED_TAGS;
rules: Map<string, IRuleConfigItem> = new Map<string, IRuleConfigItem>();
sdkverCreateReleaseBranches?: string = undefined;
excludedCommits: string[] = [];

set initialDevelopment(initialDevelopment: boolean) {
this._initialDevelopment = initialDevelopment;
Expand Down Expand Up @@ -339,6 +341,25 @@ export class Configuration {
);
}
break;

case "excluded-commits":
/* Example YAML:
* excluded-commits: []
* excluded-commits: ["3723ac94f5091257195d91a26e03492a8265b90d"]
* excluded-commits:
* - 3723ac94f5091257195d91a26e03492a8265b90d
* - 1234567890123456789012345678901234567890
*/
if (typeof data[key] === "object") {
this.excludedCommits = data[key] as string[];
} else {
throw new Error(
`Incorrect type '${typeof data[
key
]}' for '${key}', must be an array of strings!`
);
}
break;
}
}
if (
Expand Down
Loading