-
-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: unify content of ActionCoords name (#1646)
Before these changes, `ActionCoords#name` sometimes had the actual action coordinates, so for example `some-name__some-sub`, sometimes it had the replaced `some-name/some-sub`. This is not good, as you never know what you get and also led to certain bugs where wrong things are written to metadata files for example. This changes unifies the situation, so that the `name` only contains the repository name and the `path` is in a separate property with slashes. All other manipulation is then done where needed.
- Loading branch information
Showing
18 changed files
with
188 additions
and
127 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
...otlin/io/github/typesafegithub/workflows/actionbindinggenerator/generation/ClassNaming.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
package io.github.typesafegithub.workflows.actionbindinggenerator.generation | ||
|
||
import io.github.typesafegithub.workflows.actionbindinggenerator.domain.ActionCoords | ||
import io.github.typesafegithub.workflows.actionbindinggenerator.domain.fullName | ||
import io.github.typesafegithub.workflows.actionbindinggenerator.utils.toPascalCase | ||
|
||
internal fun ActionCoords.buildActionClassName(): String = this.name.toPascalCase() | ||
internal fun ActionCoords.buildActionClassName(): String = this.fullName.toPascalCase() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
...esafegithub/workflows/actionbindinggenerator/bindingsfromunittests/ActionWithSubAction.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
// This file was generated using action-binding-generator. Don't change it by hand, otherwise your | ||
// changes will be overwritten with the next binding code regeneration. | ||
// See https://github.com/typesafegithub/github-workflows-kt for more info. | ||
@file:Suppress( | ||
"DataClassPrivateConstructor", | ||
"UNUSED_PARAMETER", | ||
) | ||
|
||
package io.github.typesafegithub.workflows.actions.johnsmith | ||
|
||
import io.github.typesafegithub.workflows.domain.actions.Action | ||
import io.github.typesafegithub.workflows.domain.actions.RegularAction | ||
import java.util.LinkedHashMap | ||
import kotlin.ExposedCopyVisibility | ||
import kotlin.String | ||
import kotlin.Suppress | ||
import kotlin.Unit | ||
import kotlin.collections.Map | ||
|
||
/** | ||
* Action: Action With No Inputs | ||
* | ||
* Description | ||
* | ||
* [Action on GitHub](https://github.com/john-smith/action-with/tree/v3/sub/action) | ||
* | ||
* @param _customInputs Type-unsafe map where you can put any inputs that are not yet supported by the binding | ||
* @param _customVersion Allows overriding action's version, for example to use a specific minor version, or a newer version that the binding doesn't yet know about | ||
*/ | ||
@ExposedCopyVisibility | ||
public data class ActionWithSubAction private constructor( | ||
/** | ||
* Type-unsafe map where you can put any inputs that are not yet supported by the binding | ||
*/ | ||
public val _customInputs: Map<String, String> = mapOf(), | ||
/** | ||
* Allows overriding action's version, for example to use a specific minor version, or a newer version that the binding doesn't yet know about | ||
*/ | ||
public val _customVersion: String? = null, | ||
) : RegularAction<Action.Outputs>("john-smith", "action-with/sub/action", _customVersion ?: "v3") { | ||
public constructor( | ||
vararg pleaseUseNamedArguments: Unit, | ||
_customInputs: Map<String, String> = mapOf(), | ||
_customVersion: String? = null, | ||
) : this(_customInputs = _customInputs, _customVersion = _customVersion) | ||
|
||
@Suppress("SpreadOperator") | ||
override fun toYamlArguments(): LinkedHashMap<String, String> = LinkedHashMap(_customInputs) | ||
|
||
override fun buildOutputObject(stepId: String): Action.Outputs = Outputs(stepId) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
...lder/src/main/kotlin/io/github/typesafegithub/workflows/mavenbinding/ActionCoordsUtils.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package io.github.typesafegithub.workflows.mavenbinding | ||
|
||
import io.github.typesafegithub.workflows.actionbindinggenerator.domain.ActionCoords | ||
import io.github.typesafegithub.workflows.actionbindinggenerator.domain.subName | ||
|
||
internal val ActionCoords.mavenName: String get() = "$name${subName.replace("/", "__")}" |
Oops, something went wrong.