1
- /** Class representing a Push. */
2
1
import { getProxyUrl } from "../../config" ;
3
2
import { Step } from "./Step" ;
4
3
4
+ /**
5
+ * Class representing a Push.
6
+ */
5
7
class Action {
6
8
steps : Step [ ] = [ ] ;
7
9
error : boolean = false ;
@@ -29,6 +31,14 @@ class Action {
29
31
url : string ;
30
32
repo : string ;
31
33
34
+ /**
35
+ * Create an action.
36
+ * @param {string } id The id of the action
37
+ * @param {string } type The type of the action
38
+ * @param {string } method The method of the action
39
+ * @param {number } timestamp The timestamp of the action
40
+ * @param {string } repo The repo of the action
41
+ */
32
42
constructor ( id : string , type : string , method : string , timestamp : number , repo : string ) {
33
43
this . id = id ;
34
44
this . type = type ;
@@ -41,7 +51,7 @@ class Action {
41
51
}
42
52
43
53
/**
44
- * Add a step to the action
54
+ * Add a step to the action.
45
55
* @param {Step } step
46
56
*/
47
57
addStep ( step : Step ) : void {
@@ -59,29 +69,53 @@ class Action {
59
69
}
60
70
}
61
71
72
+ /**
73
+ * Get the last step of the action.
74
+ * @return {Step } The last step of the action
75
+ */
62
76
getLastStep ( ) : Step | undefined {
63
77
return this . lastStep ;
64
78
}
65
79
80
+ /**
81
+ * Set the commit range for the action.
82
+ * @param commitFrom the starting commit
83
+ * @param commitTo the ending commit
84
+ */
66
85
setCommit ( commitFrom : string , commitTo : string ) : void {
67
86
this . commitFrom = commitFrom ;
68
87
this . commitTo = commitTo ;
69
88
this . id = `${ commitFrom } __${ commitTo } ` ;
70
89
}
71
90
91
+ /**
92
+ * Set the branch for the action.
93
+ * @param branch the branch
94
+ */
72
95
setBranch ( branch : string ) : void {
73
96
this . branch = branch ;
74
97
}
75
98
99
+ /**
100
+ * Set the message for the action.
101
+ * @param message the message
102
+ */
76
103
setMessage ( message : string ) : void {
77
104
this . message = message ;
78
105
}
79
106
107
+ /**
108
+ * Allow the action to continue.
109
+ */
80
110
setAllowPush ( ) : void {
81
111
this . allowPush = true ;
82
112
this . blocked = false ;
83
113
}
84
114
115
+ /**
116
+ * Check if the action can continue.
117
+ * @return {boolean } true if the action can continue, false otherwise
118
+ */
85
119
continue ( ) : boolean {
86
120
return ! ( this . error || this . blocked ) ;
87
121
}
0 commit comments