Skip to content

Commit 8d81399

Browse files
committed
chore(ts): add documentation for Action.ts
1 parent 0730e5f commit 8d81399

File tree

1 file changed

+36
-2
lines changed

1 file changed

+36
-2
lines changed

src/proxy/actions/Action.ts

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
/** Class representing a Push. */
21
import { getProxyUrl } from "../../config";
32
import { Step } from "./Step";
43

4+
/**
5+
* Class representing a Push.
6+
*/
57
class Action {
68
steps: Step[] = [];
79
error: boolean = false;
@@ -29,6 +31,14 @@ class Action {
2931
url: string;
3032
repo: string;
3133

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+
*/
3242
constructor(id: string, type: string, method: string, timestamp: number, repo: string) {
3343
this.id = id;
3444
this.type = type;
@@ -41,7 +51,7 @@ class Action {
4151
}
4252

4353
/**
44-
* Add a step to the action
54+
* Add a step to the action.
4555
* @param {Step} step
4656
*/
4757
addStep(step: Step): void {
@@ -59,29 +69,53 @@ class Action {
5969
}
6070
}
6171

72+
/**
73+
* Get the last step of the action.
74+
* @return {Step} The last step of the action
75+
*/
6276
getLastStep(): Step | undefined {
6377
return this.lastStep;
6478
}
6579

80+
/**
81+
* Set the commit range for the action.
82+
* @param commitFrom the starting commit
83+
* @param commitTo the ending commit
84+
*/
6685
setCommit(commitFrom: string, commitTo: string): void {
6786
this.commitFrom = commitFrom;
6887
this.commitTo = commitTo;
6988
this.id = `${commitFrom}__${commitTo}`;
7089
}
7190

91+
/**
92+
* Set the branch for the action.
93+
* @param branch the branch
94+
*/
7295
setBranch(branch: string): void {
7396
this.branch = branch;
7497
}
7598

99+
/**
100+
* Set the message for the action.
101+
* @param message the message
102+
*/
76103
setMessage(message: string): void {
77104
this.message = message;
78105
}
79106

107+
/**
108+
* Allow the action to continue.
109+
*/
80110
setAllowPush(): void {
81111
this.allowPush = true;
82112
this.blocked = false;
83113
}
84114

115+
/**
116+
* Check if the action can continue.
117+
* @return {boolean} true if the action can continue, false otherwise
118+
*/
85119
continue(): boolean {
86120
return !(this.error || this.blocked);
87121
}

0 commit comments

Comments
 (0)