-
Notifications
You must be signed in to change notification settings - Fork 55
feat: minor version strategy rules #1687
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
Changes from 4 commits
d5decf3
f441b3a
5779e3a
ff65f6f
333e207
5e78870
a9367d6
d4b42f8
56ff712
8ed08ab
047f9da
47a9ac9
74bed3d
7e0daf4
cfee948
3caefd9
847da60
e55d1c5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| name: Minor version bump check | ||
| on: | ||
| pull_request: | ||
|
|
||
| jobs: | ||
| minor-version-bump-check: | ||
| if: github.head_ref == '^v\d+\.\d+.*$' # Only runs on branches starting with vX.X (e.g., v1.2, v1.2.3, v1.2-main) | ||
| permissions: {} | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Minor version bump check | ||
| uses: awslabs/aws-kotlin-repo-tools/.github/actions/minor-version-bump@main |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| /* | ||
| * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
|
|
||
| plugins { | ||
| kotlin("jvm") | ||
| } | ||
|
|
||
| kotlin { | ||
| sourceSets { | ||
| main { | ||
| dependencies { | ||
| implementation(libs.aws.kotlin.repo.tools.ktlint.rules) | ||
| } | ||
| } | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| /* | ||
| * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
|
|
||
| package aws.sdk.kotlin.ktlintrules.minorversionstrategy | ||
|
|
||
| import com.pinterest.ktlint.cli.ruleset.core.api.RuleSetProviderV3 | ||
| import com.pinterest.ktlint.rule.engine.core.api.RuleProvider | ||
| import com.pinterest.ktlint.rule.engine.core.api.RuleSetId | ||
| import software.aws.ktlint.rules.apisScheduledForRemovalRule | ||
|
|
||
| /** | ||
| * Ruleset provider for AWS SDK Kotlin minor-version-bump-specific Ktlint rules. | ||
| */ | ||
| class MinorVersionStrategyRuleSetProvider : RuleSetProviderV3(RuleSetId("minor-version-strategy-rules")) { | ||
| private val sdkVersion = System.getProperty("sdkVersion").split(".") | ||
|
||
| private val majorVersion = sdkVersion[0].toInt() | ||
| private val minorVersion = sdkVersion[1].toInt() | ||
|
|
||
| override fun getRuleProviders(): Set<RuleProvider> = setOf( | ||
| RuleProvider { | ||
| // Look for APIs that are scheduled for removal in upcoming minor version | ||
| apisScheduledForRemovalRule(majorVersion, minorVersion + 1) | ||
| }, | ||
| ) | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| aws.sdk.kotlin.ktlintrules.minorversionstrategy.MinorVersionStrategyRuleSetProvider |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this can be refined to only a single task using tasks.named("...")