Skip to content

Commit f0f7965

Browse files
committed
feat(library): add types support for all triggers that support activity types
1 parent 9ef264e commit f0f7965

20 files changed

Lines changed: 471 additions & 79 deletions

File tree

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,24 @@
11
package io.github.typesafegithub.workflows.domain.triggers
22

33
import kotlinx.serialization.Contextual
4+
import kotlinx.serialization.InternalSerializationApi
45
import kotlinx.serialization.Serializable
56

67
@Serializable
78
public data class BranchProtectionRule(
9+
val types: List<EventType> = emptyList(),
810
override val _customArguments: Map<String, @Contextual Any> = mapOf(),
9-
) : Trigger()
11+
) : Trigger() {
12+
@OptIn(InternalSerializationApi::class)
13+
@Serializable
14+
public sealed class EventType(
15+
public val name: String,
16+
) {
17+
public object Created : EventType("created")
18+
public object Edited : EventType("edited")
19+
public object Deleted : EventType("deleted")
20+
public data class Custom(
21+
val value: String,
22+
) : EventType(name = value)
23+
}
24+
}
Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,25 @@
11
package io.github.typesafegithub.workflows.domain.triggers
22

33
import kotlinx.serialization.Contextual
4+
import kotlinx.serialization.InternalSerializationApi
45
import kotlinx.serialization.Serializable
56

67
@Serializable
78
public data class CheckRun(
9+
val types: List<EventType> = emptyList(),
810
override val _customArguments: Map<String, @Contextual Any> = mapOf(),
9-
) : Trigger()
11+
) : Trigger() {
12+
@OptIn(InternalSerializationApi::class)
13+
@Serializable
14+
public sealed class EventType(
15+
public val name: String,
16+
) {
17+
public object Created : EventType("created")
18+
public object Rerequested : EventType("rerequested")
19+
public object Completed : EventType("completed")
20+
public object RequestedAction : EventType("requested_action")
21+
public data class Custom(
22+
val value: String,
23+
) : EventType(name = value)
24+
}
25+
}
Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,22 @@
11
package io.github.typesafegithub.workflows.domain.triggers
22

33
import kotlinx.serialization.Contextual
4+
import kotlinx.serialization.InternalSerializationApi
45
import kotlinx.serialization.Serializable
56

67
@Serializable
78
public data class CheckSuite(
9+
val types: List<EventType> = emptyList(),
810
override val _customArguments: Map<String, @Contextual Any> = mapOf(),
9-
) : Trigger()
11+
) : Trigger() {
12+
@OptIn(InternalSerializationApi::class)
13+
@Serializable
14+
public sealed class EventType(
15+
public val name: String,
16+
) {
17+
public object Completed : EventType("completed")
18+
public data class Custom(
19+
val value: String,
20+
) : EventType(name = value)
21+
}
22+
}
Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,34 @@
11
package io.github.typesafegithub.workflows.domain.triggers
22

33
import kotlinx.serialization.Contextual
4+
import kotlinx.serialization.InternalSerializationApi
45
import kotlinx.serialization.Serializable
56

67
@Serializable
78
public data class Discussion(
9+
val types: List<EventType> = emptyList(),
810
override val _customArguments: Map<String, @Contextual Any> = mapOf(),
9-
) : Trigger()
11+
) : Trigger() {
12+
@OptIn(InternalSerializationApi::class)
13+
@Serializable
14+
public sealed class EventType(
15+
public val name: String,
16+
) {
17+
public object Created : EventType("created")
18+
public object Edited : EventType("edited")
19+
public object Deleted : EventType("deleted")
20+
public object Transferred : EventType("transferred")
21+
public object Pinned : EventType("pinned")
22+
public object Unpinned : EventType("unpinned")
23+
public object Labeled : EventType("labeled")
24+
public object Unlabeled : EventType("unlabeled")
25+
public object Locked : EventType("locked")
26+
public object Unlocked : EventType("unlocked")
27+
public object CategoryChanged : EventType("category_changed")
28+
public object Answered : EventType("answered")
29+
public object Unanswered : EventType("unanswered")
30+
public data class Custom(
31+
val value: String,
32+
) : EventType(name = value)
33+
}
34+
}
Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,24 @@
11
package io.github.typesafegithub.workflows.domain.triggers
22

33
import kotlinx.serialization.Contextual
4+
import kotlinx.serialization.InternalSerializationApi
45
import kotlinx.serialization.Serializable
56

67
@Serializable
78
public data class DiscussionComment(
9+
val types: List<EventType> = emptyList(),
810
override val _customArguments: Map<String, @Contextual Any> = mapOf(),
9-
) : Trigger()
11+
) : Trigger() {
12+
@OptIn(InternalSerializationApi::class)
13+
@Serializable
14+
public sealed class EventType(
15+
public val name: String,
16+
) {
17+
public object Created : EventType("created")
18+
public object Edited : EventType("edited")
19+
public object Deleted : EventType("deleted")
20+
public data class Custom(
21+
val value: String,
22+
) : EventType(name = value)
23+
}
24+
}
Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,24 @@
11
package io.github.typesafegithub.workflows.domain.triggers
22

33
import kotlinx.serialization.Contextual
4+
import kotlinx.serialization.InternalSerializationApi
45
import kotlinx.serialization.Serializable
56

6-
/**
7-
* https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#issue_comment
8-
*/
97
@Serializable
108
public data class IssueComment(
9+
val types: List<EventType> = emptyList(),
1110
override val _customArguments: Map<String, @Contextual Any> = mapOf(),
12-
) : Trigger()
11+
) : Trigger() {
12+
@OptIn(InternalSerializationApi::class)
13+
@Serializable
14+
public sealed class EventType(
15+
public val name: String,
16+
) {
17+
public object Created : EventType("created")
18+
public object Edited : EventType("edited")
19+
public object Deleted : EventType("deleted")
20+
public data class Custom(
21+
val value: String,
22+
) : EventType(name = value)
23+
}
24+
}
Lines changed: 33 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,41 @@
11
package io.github.typesafegithub.workflows.domain.triggers
22

33
import kotlinx.serialization.Contextual
4+
import kotlinx.serialization.InternalSerializationApi
45
import kotlinx.serialization.Serializable
56

6-
/**
7-
* https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#issues
8-
*/
97
@Serializable
108
public data class Issues(
9+
val types: List<EventType> = emptyList(),
1110
override val _customArguments: Map<String, @Contextual Any> = mapOf(),
12-
) : Trigger()
11+
) : Trigger() {
12+
@OptIn(InternalSerializationApi::class)
13+
@Serializable
14+
public sealed class EventType(
15+
public val name: String,
16+
) {
17+
public object Opened : EventType("opened")
18+
public object Edited : EventType("edited")
19+
public object Deleted : EventType("deleted")
20+
public object Transferred : EventType("transferred")
21+
public object Pinned : EventType("pinned")
22+
public object Unpinned : EventType("unpinned")
23+
public object Closed : EventType("closed")
24+
public object Reopened : EventType("reopened")
25+
public object Assigned : EventType("assigned")
26+
public object Unassigned : EventType("unassigned")
27+
public object Labeled : EventType("labeled")
28+
public object Unlabeled : EventType("unlabeled")
29+
public object Locked : EventType("locked")
30+
public object Unlocked : EventType("unlocked")
31+
public object Milestoned : EventType("milestoned")
32+
public object Demilestoned : EventType("demilestoned")
33+
public object Typed : EventType("typed")
34+
public object Untyped : EventType("untyped")
35+
public object FieldAdded : EventType("field_added")
36+
public object FieldRemoved : EventType("field_removed")
37+
public data class Custom(
38+
val value: String,
39+
) : EventType(name = value)
40+
}
41+
}
Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,24 @@
11
package io.github.typesafegithub.workflows.domain.triggers
22

33
import kotlinx.serialization.Contextual
4+
import kotlinx.serialization.InternalSerializationApi
45
import kotlinx.serialization.Serializable
56

6-
/**
7-
* https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#label
8-
*/
97
@Serializable
108
public data class Label(
9+
val types: List<EventType> = emptyList(),
1110
override val _customArguments: Map<String, @Contextual Any> = mapOf(),
12-
) : Trigger()
11+
) : Trigger() {
12+
@OptIn(InternalSerializationApi::class)
13+
@Serializable
14+
public sealed class EventType(
15+
public val name: String,
16+
) {
17+
public object Created : EventType("created")
18+
public object Edited : EventType("edited")
19+
public object Deleted : EventType("deleted")
20+
public data class Custom(
21+
val value: String,
22+
) : EventType(name = value)
23+
}
24+
}
Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,22 @@
11
package io.github.typesafegithub.workflows.domain.triggers
22

33
import kotlinx.serialization.Contextual
4+
import kotlinx.serialization.InternalSerializationApi
45
import kotlinx.serialization.Serializable
56

6-
/**
7-
* https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#merge_group
8-
*/
97
@Serializable
108
public data class MergeGroup(
9+
val types: List<EventType> = emptyList(),
1110
override val _customArguments: Map<String, @Contextual Any> = mapOf(),
12-
) : Trigger()
11+
) : Trigger() {
12+
@OptIn(InternalSerializationApi::class)
13+
@Serializable
14+
public sealed class EventType(
15+
public val name: String,
16+
) {
17+
public object ChecksRequested : EventType("checks_requested")
18+
public data class Custom(
19+
val value: String,
20+
) : EventType(name = value)
21+
}
22+
}
Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,26 @@
11
package io.github.typesafegithub.workflows.domain.triggers
22

33
import kotlinx.serialization.Contextual
4+
import kotlinx.serialization.InternalSerializationApi
45
import kotlinx.serialization.Serializable
56

6-
/**
7-
* https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#milestone
8-
*/
97
@Serializable
108
public data class Milestone(
9+
val types: List<EventType> = emptyList(),
1110
override val _customArguments: Map<String, @Contextual Any> = mapOf(),
12-
) : Trigger()
11+
) : Trigger() {
12+
@OptIn(InternalSerializationApi::class)
13+
@Serializable
14+
public sealed class EventType(
15+
public val name: String,
16+
) {
17+
public object Created : EventType("created")
18+
public object Closed : EventType("closed")
19+
public object Opened : EventType("opened")
20+
public object Edited : EventType("edited")
21+
public object Deleted : EventType("deleted")
22+
public data class Custom(
23+
val value: String,
24+
) : EventType(name = value)
25+
}
26+
}

0 commit comments

Comments
 (0)