Skip to content

Commit af2572f

Browse files
committed
fix: Add comments
1 parent 7e59e96 commit af2572f

File tree

12 files changed

+426
-19
lines changed

12 files changed

+426
-19
lines changed

lib/package/concurrency.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@ import type { Expression } from "./expression";
33
export type Concurrency =
44
| string
55
| {
6+
/**
7+
* When a concurrent job or workflow is queued, if another job or workflow using the same concurrency group in the repository is in progress, the queued job or workflow will be pending. Any previously pending job or workflow in the concurrency group will be canceled.
8+
*/
69
group: string;
10+
/**
11+
* To cancel any currently running job or workflow in the same concurrency group, specify true.
12+
*/
713
cancelInProgress?: boolean | Expression;
814
};

lib/package/container.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,38 @@
11
import type { Env } from "./env";
22

33
export type Container = {
4+
/**
5+
* The Docker image to use as the container to run the action.
6+
* The value can be the Docker Hub image name or a registry name.
7+
*/
48
image: string;
9+
/**
10+
* If the image's container registry requires authentication to pull the image, you can use credentials to set a map of the username and password.
11+
* The credentials are the same values that you would provide to the `docker login` command.
12+
*/
513
credentials?: {
614
username?: string;
715
password?: string;
816
};
17+
/**
18+
* Sets an array of environment variables in the container.
19+
*/
920
env?: Env;
21+
/**
22+
* Sets an array of ports to expose on the container.
23+
*/
1024
ports?: (number | string)[];
25+
/**
26+
* Sets an array of volumes for the container to use.
27+
* You can use volumes to share data between services or other steps in a job.
28+
* You can specify named Docker volumes, anonymous Docker volumes, or bind mounts on the host.
29+
* To specify a volume, you specify the source and destination path: <source>:<destinationPath>
30+
* The <source> is a volume name or an absolute path on the host machine, and <destinationPath> is an absolute path in the container.
31+
*/
1132
volumes?: string[];
33+
/**
34+
* Additional Docker container resource options.
35+
* @see https://docs.docker.com/engine/reference/commandline/create/#options.
36+
*/
1237
options?: string;
1338
};

lib/package/env.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/**
2+
* To set custom environment variables, you need to specify the variables in the workflow file.
3+
* You can define environment variables for a step, job, or entire workflow using the jobs.<job_id>.steps[*].env, jobs.<job_id>.env, and env keywords.
4+
* @see https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions#jobsjob_idstepsenv
5+
*/
16
export type Env = {
27
[key: string]: string;
38
};

lib/package/environment.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
1+
/**
2+
* The environment that the job references.
3+
*/
14
export type Environment =
25
| string
36
| {
7+
/**
8+
* The name of the environment configured in the repo.
9+
*/
410
name: string;
11+
/**
12+
* A deployment URL.
13+
*/
514
url?: string;
615
};

lib/package/job.ts

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,23 +18,90 @@ import { type RunStep, type Step, type UsesStep } from "./step";
1818
import type { Strategy } from "./strategy";
1919

2020
type JobConfigBase = {
21+
/**
22+
* The name of the job displayed on GitHub.
23+
*/
2124
name?: string;
25+
/**
26+
* Identifies any jobs that must complete successfully before this job will run.
27+
* It can be a string or array of strings.
28+
* If a job fails, all jobs that need it are skipped unless the jobs use a conditional statement that causes the job to continue.
29+
*/
2230
needs?: string | string[];
2331
permissions?: Permissions;
32+
/**
33+
* You can use the if conditional to prevent a job from running unless a condition is met.
34+
* You can use any supported context and expression to create a conditional.
35+
* Expressions in an if conditional do not require the ${{ }} syntax.
36+
* @see https://help.github.com/en/articles/contexts-and-expression-syntax-for-github-actions.
37+
*/
2438
if?: string | boolean;
39+
/**
40+
* A strategy creates a build matrix for your jobs.
41+
* You can define different variations of an environment to run each job in.
42+
*/
2543
strategy?: Strategy;
44+
/**
45+
* Concurrency ensures that only a single job or workflow using the same concurrency group will run at a time.
46+
* A concurrency group can be any string or expression.
47+
* The expression can use any context except for the secrets context.
48+
* You can also specify concurrency at the workflow level.
49+
* When a concurrent job or workflow is queued, if another job or workflow using the same concurrency group in the repository is in progress, the queued job or workflow will be pending.
50+
* Any previously pending job or workflow in the concurrency group will be canceled.
51+
* To also cancel any currently running job or workflow in the same concurrency group, specify `cancelInProgress: true`.
52+
*/
2653
concurrency?: Concurrency;
2754
};
2855

2956
export type NormalJobConfig = JobConfigBase & {
57+
/**
58+
* The type of machine to run the job on.
59+
* The machine can be either a GitHub-hosted runner, or a self-hosted runner.
60+
*/
3061
runsOn: RunsOn;
62+
/**
63+
* The environment that the job references.
64+
*/
3165
environment?: Environment;
66+
/**
67+
* A map of outputs for a job.
68+
* Job outputs are available to all downstream jobs that depend on this job.
69+
*/
3270
outputs?: Record<string, string>;
71+
/**
72+
* A map of environment variables that are available to all steps in the job.
73+
*/
3374
env?: Env;
75+
/**
76+
* A map of default settings that will apply to all steps in the job.
77+
*/
3478
defaults?: Defaults;
79+
/**
80+
* The maximum number of minutes to let a workflow run before GitHub automatically cancels it.
81+
* @default 360
82+
*/
3583
timeoutMinutes?: number | Expression;
84+
/**
85+
* Prevents a workflow run from failing when a job fails.
86+
* Set to true to allow a workflow run to pass when this job fails.
87+
*/
3688
continueOnError?: boolean | Expression;
89+
/**
90+
* A container to run any steps in a job that don't already specify a container.
91+
* If you have steps that use both script and container actions, the container actions will run as sibling containers on the same network with the same volume mounts.
92+
* If you do not set a container, all steps will run directly on the host specified by runs-on unless a step refers to an action configured to run in a container.
93+
*/
3794
container?: Container;
95+
/**
96+
* Additional containers to host services for a job in a workflow.
97+
* These are useful for creating databases or cache services like redis.
98+
* The runner on the virtual machine will automatically create a network and manage the life cycle of the service containers.
99+
* When you use a service container for a job or your step uses container actions, you don't need to set port information to access the service.
100+
* Docker automatically exposes all ports between containers on the same network.
101+
* When both the job and the action run in a container, you can directly reference the container by its hostname.
102+
* The hostname is automatically mapped to the service name.
103+
* When a step does not use a container action, you must access the service using localhost and bind the ports.
104+
*/
38105
services?: Record<string, Container>;
39106
};
40107

lib/package/matrix.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
import type { Expression } from "./expression";
22

3+
/**
4+
* A build matrix is a set of different configurations of the virtual environment.
5+
* For example you might run a job against more than one supported version of a language, operating system, or tool.
6+
* Each configuration is a copy of the job that runs and reports a status.
7+
* You can specify a matrix by supplying an array for the configuration options.
8+
* For example, if the GitHub virtual environment supports Node.js versions 6, 8, and 10 you could specify an array of those versions in the matrix.
9+
* When you define a matrix of operating systems, you must set the required runs-on keyword to the operating system of the current job, rather than hard-coding the operating system name.
10+
* To access the operating system name, you can use the matrix.os context parameter to set runs-on.
11+
* @see https://help.github.com/en/articles/contexts-and-expression-syntax-for-github-actions.
12+
*/
313
export type Matrix =
414
| Expression
515
| { [key: string]: Expression | Configuration[] }

0 commit comments

Comments
 (0)